Adding plugin specific code before CasC installs plugin kills Jenkins
See original GitHub issueNew Jenkins server. CasC plugin is installed, then Jenkins is restarted and config file added. Having the code for the bitbucket server endpoint in the CasC config file causes Jenkins to not boot and only show the below stack trace.
When system is created without bitbucket entry in config, and only added after CasC installs all the plugins and Jenkins manually restarted again with the new config info in the yaml, it works.
This kinda defeats the purpose of having configuration code if having the desired config loaded at the same time/prior to the plugin install causes the system to crash. Is there a way to make CasC ignore code that isn’t applicable until after a plugin is installed?
Am I doing something wrong with how i’m setting up the yaml or my order of operations? None of the plugins I install seem to auto restart Jenkins as in #622.
Any help would be appreciated.
- [2.138.2] Jenkins version
- [1.2] CasC Plugin version
- [CentOS Linux release 7.5.1804 (Core)] OS
jenkins.yaml:
plugins:
required:
blueocean: latest
greenballs: latest
active-directory: latest
nunit: latest
job-dsl: latest
sites:
- id: "default"
url: "https://updates.jenkins.io/update-center.json"
jenkins:
agentProtocols:
- "JNLP4-connect"
- "Ping"
crumbIssuer:
standard:
excludeClientIPFromCrumb: false
disableRememberMe: false
mode: NORMAL
numExecutors: 0
primaryView:
all:
name: "all"
quietPeriod: 5
scmCheckoutRetryCount: 0
slaveAgentPort: 9999
systemMessage: "This Jenkins server has been auto configured"
views:
- all:
name: "all"
unclassified:
bitbucketendpointconfiguration:
endpoints:
- bitbucketServerEndpoint:
displayName: "Stash"
manageHooks: false
serverUrl: "http://<IP Removed>"
Stack trace:
io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.model.GlobalConfigurationCategory$Unclassified : bitbucketendpointconfiguration.
Available attributes : administrativemonitorsconfiguration, artifactManager, cascglobalconfig, cloud, defaultView, location, masterBuild, myView, nodeProperties, plugin, pollSCM, projectNamingStrategy, quietPeriod, scmRetryCount, shell, usagestatistics, viewsTabBar
at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:363)
at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:352)
at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:273)
at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$8(ConfigurationAsCode.java:645)
at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:608)
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:614)
at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:645)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:630)
at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:542)
at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:272)
at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:264)
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:1069)
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)
Caused: org.jvnet.hudson.reactor.ReactorException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:1103)
at jenkins.model.Jenkins.<init>(Jenkins.java:907)
at hudson.model.Hudson.<init>(Hudson.java:85)
at hudson.model.Hudson.<init>(Hudson.java:81)
at hudson.WebAppMain$3.run(WebAppMain.java:233)
Caused: hudson.util.HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:250)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
We no longer support plugin installation as of v1.8 see #769 and [JENKINS-53767] Offer plugin management tooling
running a jenkins in a docker container and installing plugins via install-plugins.sh is the recommended solution. It comes with limitations but it is the only one that works good right now