scrow
scrow

Reputation: 447

Jenkins configuration-as-code plugin failing

I have two Jenkins both on the same version 2.289.3. One has this plugin working fine (plugin version 1.54) but the other is failing with the error in the below error code. It's failing on the plugin extensions

 io.jenkins.plugins.casc.ConfiguratorException: No configurator for the following root elements jobs
    at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:734)
    at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:776)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:761)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:637)
    at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:306)
    at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:298)
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)

These two Jenkins run off of different config repositories but the major files are all the same. I removed the plugin from the startup plugins.txt file and tried installing it on a running Jenkins but that results in the same problem when I then restart Jenkins (below image and error)

org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException

enter image description here

I've also tried copying the plugins from other repositories that have no problems but here it just keeps failing. Any advice on what the problem might be would be great

Upvotes: 3

Views: 3783

Answers (2)

Nick
Nick

Reputation: 156

For me, the problem was changing the following:

groovy:
  groovy:
    - script: |

to:

groovy:
  - script: >

in the jenkins.yaml casc file.

Upvotes: 0

scrow
scrow

Reputation: 447

The solution to my problem was that I was missing another plugin. The plugin in question was job-dsl - specifically version 1.74 of this plugin. I found some of the later version also caused problems so had to pin it to 1.74

Upvotes: 1

Related Questions