Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57520

Declaring Tools installation via JCasC doesn't work as expected

    Details

    • Similar Issues:

      Description

      Basic declaration via JCasC yaml like:

      tool:
        groovy:
          installations:
            - name: "Groovy1"
              home: "/bin/groovy"
      

      doesn't work - it produces an exception:

      May 17, 2019 11:51:05 AM jenkins.InitReactorRunner$1 onTaskFailed
      SEVERE: Failed ConfigurationAsCode.init
      java.lang.Error: java.lang.reflect.InvocationTargetException
              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:1096)
              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 by: 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)
              ... 8 more
      Caused by: io.jenkins.plugins.casc.ConfiguratorException: tool: error configuring 'tool' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator
              at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633)
              at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665)
              at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649)
              at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548)
              at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277)
              at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269)
              ... 13 more
      Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.tools.ToolConfigurationCategory : groovy.
      Available attributes : ant, dockerTool, git, gradle, groovyInstallation, jdk, jgit, jgitapache, maven, mercurialInstallation, oc
              at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372)
              at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361)
              at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282)
              at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665)
              at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627)
              ... 18 more
      

      Other Tools installation declaration like JDK, Maven, Ant etc. works as expected, so this should work too.

        Attachments

          Activity

          Hide
          pajasoft Pavel Janoušek added a comment -

          Tried on core 2.164.3, CaC 1.15 and Groovy 2.2 now. Export places its parts on two places as posted below. I think it isn't correct and needs to be fixed as I specify.

          Exported:

          unclassified:
            groovy:
              installations:
              - home: "/bin/groovy1"
                name: "Groovy1"
              - home: "/bin/groovy2"
                name: "Groovy2"
          
          tool:
            groovyInstallation:
              defaultProperties:
              - installSource:
                  installers:
                  - "groovyInstaller"
              installations:
              - home: "/bin/groovy1"
                name: "Groovy1"
              - home: "/bin/groovy2"
                name: "Groovy2"
          

          Expected:

          tool:
            groovy:
              installations:
              - home: "/bin/groovy1"
                name: "Groovy1"
              - home: "/bin/groovy2"
                name: "Groovy2"
          
          Show
          pajasoft Pavel Janoušek added a comment - Tried on core 2.164.3, CaC 1.15 and Groovy 2.2 now. Export places its parts on two places as posted below. I think it isn't correct and needs to be fixed as I specify. Exported: unclassified: groovy: installations: - home: "/bin/groovy1" name: "Groovy1" - home: "/bin/groovy2" name: "Groovy2" tool: groovyInstallation: defaultProperties: - installSource: installers: - "groovyInstaller" installations: - home: "/bin/groovy1" name: "Groovy1" - home: "/bin/groovy2" name: "Groovy2" Expected: tool: groovy: installations: - home: "/bin/groovy1" name: "Groovy1" - home: "/bin/groovy2" name: "Groovy2"

            People

            • Assignee:
              vjuranek vjuranek
              Reporter:
              pajasoft Pavel Janoušek
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: