Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve version inconsistency with oauth-credentials #205

Conversation

nagyo
Copy link
Contributor

@nagyo nagyo commented Nov 22, 2023

In #188 a dependency inconsistency was introduced by removing the version of oauth-credentials (at that time 0.646.v02b_66dc03d2e), see:

https://github.com/jenkinsci/google-oauth-plugin/pull/188/files#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8L182

and adding a bom version (2465.va_e76ed7b_3061) that contains the previous version (0.645.ve666a_c332668) of oauth-credentials.

See bom version added:
https://github.com/jenkinsci/google-oauth-plugin/pull/188/files#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R89

See version of oauth-credentials in bom:
https://github.com/jenkinsci/bom/blob/2465.va_e76ed7b_3061/bom-weekly/pom.xml#L715

Due to this change when installing the google-oauth-plugin to a vanilla Jenkins (2.426.1) the following exception is thrown:

2023-11-22 16:11:17.132+0000 [id=160]   WARNING hudson.ExtensionFinder$Sezpoz#_find: Failed to load com.google.jenkins.plugins.credentials.oauth.OAuth2Credentials$DescriptorImpl
java.lang.ClassNotFoundException: com.google.jenkins.plugins.credentials.oauth.OAuth2Credentials$DescriptorImpl
        at hudson.PluginManager$UberClassLoader.lambda$findClass$0(PluginManager.java:2340)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at hudson.PluginManager$UberClassLoader.findClass(PluginManager.java:2340)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at net.java.sezpoz.IndexItem.element(IndexItem.java:134)
Caused: java.lang.InstantiationException: /var/jenkins_home/plugins/google-oauth-plugin/WEB-INF/lib/google-oauth-plugin.jar might need to be rebuilt
        at net.java.sezpoz.IndexItem.element(IndexItem.java:144)
        at hudson.ExtensionFinder.getClassFromIndex(ExtensionFinder.java:785)
        at hudson.ExtensionFinder$Sezpoz._find(ExtensionFinder.java:745)
        at hudson.ExtensionFinder$Sezpoz$1.find(ExtensionFinder.java:715)
        at hudson.ExtensionFinder$GuiceFinder.refresh(ExtensionFinder.java:342)
        at jenkins.model.Jenkins.refreshExtensions(Jenkins.java:2908)
        at hudson.PluginManager.start(PluginManager.java:990)
        at hudson.model.UpdateCenter$CompleteBatchJob.run(UpdateCenter.java:2367)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121)
        at java.base/java.lang.Thread.run(Thread.java:840)
2023-11-22 16:11:17.153+0000 [id=160]   WARNING h.ExtensionFinder$GuiceFinder$SezpozModule#configure: Failed to load com.google.jenkins.plugins.credentials.oauth.OAuth2Credentials$DescriptorImpl
java.lang.ClassNotFoundException: com.google.jenkins.plugins.credentials.oauth.OAuth2Credentials$DescriptorImpl
        at hudson.PluginManager$UberClassLoader.lambda$findClass$0(PluginManager.java:2340)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at hudson.PluginManager$UberClassLoader.findClass(PluginManager.java:2340)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at net.java.sezpoz.IndexItem.element(IndexItem.java:134)
Caused: java.lang.InstantiationException: /var/jenkins_home/plugins/google-oauth-plugin/WEB-INF/lib/google-oauth-plugin.jar might need to be rebuilt
        at net.java.sezpoz.IndexItem.element(IndexItem.java:144)
        at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:566)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:64)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:426)
        at com.google.inject.spi.Elements.getElements(Elements.java:113)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:160)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
        at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:240)
        at hudson.ExtensionFinder$GuiceFinder.refresh(ExtensionFinder.java:347)
        at jenkins.model.Jenkins.refreshExtensions(Jenkins.java:2908)
        at hudson.PluginManager.start(PluginManager.java:990)
        at hudson.model.UpdateCenter$CompleteBatchJob.run(UpdateCenter.java:2367)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121)
        at java.base/java.lang.Thread.run(Thread.java:840)
2023-11-22 16:11:22.978+0000 [id=186]   INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization

This originates back to a java API change in the oauth-credentials-plugin, see jenkinsci/oauth-credentials-plugin#16

With the update of the bom version the proper oauth-credentials plugin is registered as a dependency, see changes between the current and the next bom version:

jenkinsci/bom@2465.va_e76ed7b_3061...2483.v3b_22f030990a_#diff-df30c196b4c4872fdfa9378b991827b2433d220d66f83c0f0a1e868010ee3767R720

The PR aims to resolve issues #200 and #204

Testing done

Local maven build passed with the updated bom version.
A locally built hpi file was installed on a vanilla Jenkins (2.426.1), no exceptions were observed.

I'm no expert of dependency chains between different Jenkins plugins, so please take that into consideration, I just followed the clues along the way.

Submitter checklist

Preview Give feedback

@nagyo nagyo changed the title Bump bom version to resolve dependency issues with oauth-credentials Resolve version inconsistency with oauth-credentials Nov 22, 2023
@nagyo
Copy link
Contributor Author

nagyo commented Nov 23, 2023

Kindly pinging the owners of the origin PRs, if you could take a look that would be awesome 🙏🏻 , @jenkinsci/google-oauth-plugin-developers, @amuniz, @basil

@basil basil merged commit 5cb58b9 into jenkinsci:develop Nov 24, 2023
@nagyo nagyo deleted the bugfix/resolve_version_inconsistency_in_oauth_credentials branch November 27, 2023 08:21
@viceice
Copy link
Member

viceice commented Nov 27, 2023

Please create a new release to include this fix 🤗

@amuniz
Copy link
Member

amuniz commented Nov 27, 2023

Note that the warning is just a warning and should not affect any real feature of this plugin.
A release was not automatically generated because the PR lacks the right labels. I'll trigger a release now.

@amuniz
Copy link
Member

amuniz commented Nov 27, 2023

I'll trigger a release now.

Oh, I can't as I don't have permissions. Can you take care @basil? I think if you add one of the "releaseable" labels to this PR and trigger the cd pipeline then it will generate a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants