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

Cannot configure SonarQube plugin with JCasC

    Details

    • Similar Issues:
    • Released As:
      sonar-2.11

      Description

      The most recent version of JCasC that works with SonarQube is 1.23. Anything after that results in

      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:1095)
      	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: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator
      	at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:652)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:684)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:668)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:567)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:280)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:272)
      	... 13 more
      Caused by: io.jenkins.plugins.casc.ConfiguratorException: triggers is required to configure class hudson.plugins.sonar.SonarInstallation
      	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:134)
      	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:77)
      	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:268)
      	at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:101)
      	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:345)
      	at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:288)
      	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:353)
      	at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:288)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:684)
      	at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:646)
      	... 18 more

      I'm doing this:

      sonarglobalconfiguration:
        buildWrapperEnabled: true
        installations:
          - name: "SonarQube 1"
            serverUrl: "http://example.com/sonar1"
            serverAuthenticationToken: "asdasd"
          - name: "SonarQube 2"
            serverUrl: "https://example.com/sonar2"
            serverAuthenticationToken: "fvcxvffsadfasdd"

        Attachments

          Activity

          Hide
          mchugunova Maria Chugunova added a comment -

          I think this issue should be fixed, but if someone is blocked when try the following configuration which works for me with plugins sonarqube 2.9 and jcasc 1.26. Probably with jcasc 1.24 it will work too.

          unclassified:
            sonarglobalconfiguration:
              buildWrapperEnabled: true
              installations:
                - name: sonarqube
                  serverUrl: https://sonarqube
                  credentialsId: token-sonarqube
                  serverAuthenticationToken: "" 
                  additionalAnalysisProperties:
                  additionalProperties:
                  mojoVersion:
                  triggers:
                    envVar:
                    skipScmCause: false
                    skipUpstreamCause: false
          
          Show
          mchugunova Maria Chugunova added a comment - I think this issue should be fixed, but if someone is blocked when try the following configuration which works for me with plugins sonarqube 2.9 and jcasc 1.26. Probably with jcasc 1.24 it will work too. unclassified: sonarglobalconfiguration: buildWrapperEnabled: true installations: - name: sonarqube serverUrl: https: //sonarqube credentialsId: token-sonarqube serverAuthenticationToken: "" additionalAnalysisProperties: additionalProperties: mojoVersion: triggers: envVar: skipScmCause: false skipUpstreamCause: false
          Hide
          smasher Daniel Estermann added a comment -

          This has been fixed in https://github.com/SonarSource/sonar-scanner-jenkins/commit/9d26afbe8c8cd29c00afdb156205546ae3b381ec but now we all wait for the release of this plugin...

          Show
          smasher Daniel Estermann added a comment - This has been fixed in https://github.com/SonarSource/sonar-scanner-jenkins/commit/9d26afbe8c8cd29c00afdb156205546ae3b381ec but now we all wait for the release of this plugin...
          Hide
          smasher Daniel Estermann added a comment -

          My mistake, triggers is still required. I opened another PR for that https://github.com/SonarSource/sonar-scanner-jenkins/pull/136

          Show
          smasher Daniel Estermann added a comment - My mistake, triggers is still required. I opened another PR for that https://github.com/SonarSource/sonar-scanner-jenkins/pull/136
          Hide
          smasher Daniel Estermann added a comment -

          Released as 2.11

          Show
          smasher Daniel Estermann added a comment - Released as 2.11

            People

            • Assignee:
              smasher Daniel Estermann
              Reporter:
              svenstaro Sven-Hendrik Haase
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: