question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding plugin specific code before CasC installs plugin kills Jenkins

See original GitHub issue

New 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
jetersencommented, Mar 20, 2019

We no longer support plugin installation as of v1.8 see #769 and [JENKINS-53767] Offer plugin management tooling

2reactions
ewelinawilkoszcommented, Jan 16, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

jenkinsci/configuration-as-code-plugin - Gitter
I tried running it on docker with a RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt step but casc plugin fails with: java.lang.
Read more >
Extension Points defined in Jenkins Core
Plugins may want to contribute additional restrictions on the use of specific labels for specific projects. This extension point allows such restrictions.
Read more >
I would like to install one Jenkins plugin on my company's ...
Plugins are global, not per-user. It will restart the Jenkins server process, which usually takes a minute or two. Restarting the Jenkins ......
Read more >
Jenkins change log
UsageStatistics not compatible with CasC plugin; JENKINS-54653 OPEN ... JENKINS-54633 IN PROGRESS build dedicated VPC while installing ...
Read more >
CMV: Jenkins shouldn't be anywhere near a robust, mature ...
Rebooting Jenkins to install a plugin is annoying and there are no ... I see Jenkins as a DevOps architect, my first plan...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found