jenkinsfile-runner: ConfiguratorException when using casc credentials with 1.0-beta-13/14

When starting jenkinsfile-runner with credentials present in the casc yaml, an exception occurs during launch:

2020-07-28 11:42:58.176+0000 [id=28]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed ConfigurationAsCode.init
io.jenkins.plugins.casc.ConfiguratorException: No configurator for the following root elements credentials
        at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:713)
        at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:755)
        at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:740)
        at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:616)
        at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:298)
        at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:290)
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:1131)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
        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)

The configuration yaml:

credentials:
  system:
    domainCredentials:
      - credentials:
          - UsernamePasswordCredentialsImpl:
              scope: GLOBAL
              id: sample_credential
              username: sample_user
              password: sample_password

This constellation still worked with beta-12.

Am I missing some config change or required plugin?

plugins.txt

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Sorry, I missed the previous message due to my vacation @bparzella . I will try to take a look

So I did some more testing and I created a minimal example that reproduces the error for me.

Background: in my use case the pipeline uses credentials, which are defined in the casc yaml.

So if I have the casc plugin present in the plugins.txt (which was okay before beta 13), I get the error I reported initially. This is how the attached example is set up.

If I remove the casc plugin from the plugins.txt, there seems to be an issue, loading the credentials from the casc yaml:

[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in d:\UserData\z0046afz\src\jfr_test\workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: sample_credential
Finished: FAILURE

(This error is the same in beta 12.)

To reproduce this error with the example, simply remove casc from the plugins.txt.

The Example: A script for downloading the JFR jar is present in the install folder, the jfr_test.bat runs JFR with plugins, config and Jenkinsfile.

jfr_test.zip

Need more logs, probably the credentials plugin failed to load for some reason