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

Plugin conflicting with global library configuration when configured with JCasC #319

Open
efernandes-dev-ops opened this issue Mar 9, 2020 · 7 comments

Comments

@efernandes-dev-ops
Copy link

efernandes-dev-ops commented Mar 9, 2020

We seemed to have noticed an issue with the plugin. It seems to conflict with the global library configuration when it is configured via jenkins configuration as code. We get back the following errors:

2020-03-09 10:51:00.947+0000 [id=26]	SEVERE	jenkins.InitReactorRunner$1#onTaskFailed: Failed ConfigurationAsCode.init
io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class com.github.kostyasha.github.integration.multibranch.GitHubSCMSource : repoOwner,credentialsId,configuredByUrl,repositoryUrl.
Available attributes : handlers, id, projectUrlStr, repoProvider, scmFactory, traits
	at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:377)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:366)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:276)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:83)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:278)
	at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:247)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:278)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:86)
	at io.vavr.control.Option.map(Option.java:392)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:86)
	at io.vavr.Tuple2.apply(Tuple2.java:238)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:83)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:55)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:160)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:77)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:267)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:83)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:278)
	at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:247)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:278)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:86)
	at io.vavr.control.Option.map(Option.java:392)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:86)
	at io.vavr.Tuple2.apply(Tuple2.java:238)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:83)
	at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:55)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:160)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:77)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:267)
	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:101)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:344)
	at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:352)
	at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:287)
	at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$7(ConfigurationAsCode.java:746)
	at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:696)
Caused: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator
	at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:702)
	at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:746)
	at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:731)
	at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:611)
	at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:292)
	at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:284)
Caused: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
Caused: java.lang.Error
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
	at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1122)
	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2020-03-09 10:51:00.949+0000 [id=19]	SEVERE	hudson.util.BootFailure#publish: Failed to initialize Jenkins

Any ideas why would be helpful. Thanks

@KostyaSha
Copy link
Owner

How i can reproduce it locally?

@efernandes-dev-ops
Copy link
Author

efernandes-dev-ops commented Mar 9, 2020

Hey @KostyaSha

Thanks for getting back to me.

Steps for reproducing:

  1. You will need to install the https://github.com/jenkinsci/configuration-as-code-plugin and then you will need to add the following configuration for the global library
globalLibraries:
   libraries:
   - defaultVersion: "master"
     implicit: true
     includeInChangesets: false
     name: "global"
     retriever:
       modernSCM:
         scm:
           github:
             configuredByUrl: true
             credentialsId: "global-library"
             repoOwner: "xxxx"
             repository: "xxxxx"
             repositoryUrl: "xxxx"
  1. You will then be able to see the global library configuration in Configure System.

  2. Once the above has been set. You will then need to install the github-integration-plugin.

As soon as you install the github integration plugin the above errors will throw.

I have tried doing it the reverse order as well, installing the plugin first and then setting the configuration for the global library and it throws the same errors above.

@KostyaSha
Copy link
Owner

Btw, do you have github-branch-source-plugin?

@efernandes-dev-ops
Copy link
Author

Yup. These are all the git/github plugins I've got installed

"git-client:3.2.0", "git-server:1.9", "git:4.2.0", "github-api:1.106", "github-branch-source:2.6.0", "github-oauth:0.33", "github:1.29.5", "google-oauth-plugin:1.0.0", "github-pullrequest:0.2.8"

@johanblumenberg
Copy link

This line is the problem:

There is a name conflict, since there are multiple SCM sources named "github".

A simple way to fix the problem is to rename the SCM source to "githubPullrequest" or similar, to use the same name as the plugin that provides it.

@vittoriocanilli
Copy link

I am having the same issue, both via JCasC and via GUI. You just need to have at least a global library defined in your Jenkins System settings and after that you install the GitHub Integration plugin, you will see in the logs the error reported originally by @efernandes-dev-ops

@KostyaSha Any update about this issue?

@johanblumenberg Thanks for your investigation! Did you suggest a solution for the plugin's developer or for the issue's reporter? I didn't get it.

@johanblumenberg
Copy link

@vittoriocanilli I meant it as a solution for the plugin developer. But you could fork this plugin and fix it, and use your own version of the plugin.

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

No branches or pull requests

4 participants