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

Quality-gates plugin do not work with SonarQube 6.3

    Details

    • Similar Issues:

      Description

      Quality-gates plugin does not work with SonarQube 6.3.

      Since SonarQube 6.3, api has been removed/changed.

      https://docs.sonarqube.org/display/DEV/API+Changes

      Error message in Jenkins build log:
      quality.gates.jenkins.plugin.QGException: Expected status 200, got: 404. Response: {"errors":[\{"msg":"Unknown url : /api/events"}]}
      at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59)
      at quality.gates.sonar.api.SonarHttpRequester.getAPIInfo(SonarHttpRequester.java:47)
      at quality.gates.sonar.api.QualityGatesProvider.getRequesterResult(QualityGatesProvider.java:34)
      at quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:29)
      at quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:20)
      at quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:73)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
      at hudson.model.Run.execute(Run.java:1758)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:405)
      Build step 'Quality Gates' marked build as failure
      Finished: FAILURE

        Attachments

          Activity

          Hide
          thanhpolimi Pham Tien Thanh added a comment - - edited

          Sure! I need a little time for this cause I am busy on other project. 

          The password default is set to 'admin' but you can/must config the plugin it self in Jenkin > Configure with your appropriate user/password.

          Access token support will be added soon. 

          Show
          thanhpolimi Pham Tien Thanh added a comment - - edited Sure! I need a little time for this cause I am busy on other project.  The password default is set to 'admin' but you can/must config the plugin it self in Jenkin > Configure with your appropriate user/password. Access token support will be added soon. 
          Hide
          thanhpolimi Pham Tien Thanh added a comment -

          Dear Charlie

          I update the project with new feature that support access token. 

          Please build the project using the following command : mvn clean install 

          You are going to get the hpi file which then can be installed into Jenkin as Quality Gate Plugin.

          Best regards

          Show
          thanhpolimi Pham Tien Thanh added a comment - Dear Charlie I update the project with new feature that support access token.  Please build the project using the following command : mvn clean install  You are going to get the hpi file which then can be installed into Jenkin as Quality Gate Plugin. Best regards
          Hide
          atuldalvi123i atul dalvi added a comment -

          I am getting the same error
          quality.gates.jenkins.plugin.QGException: Expected status 200, got: 404. Response: {"errors":[\{"msg":"Unknown url : /api/events"}]}
          How can i solve this ?

          Show
          atuldalvi123i atul dalvi added a comment - I am getting the same error quality.gates.jenkins.plugin.QGException: Expected status 200, got: 404. Response: {"errors": [\{"msg":"Unknown url : /api/events"}] } How can i solve this ?
          Hide
          twex Thomas O'Reilly added a comment - - edited

          I'm seeing the same error.

          According to sonarqube docs "api/events is removed, api/project_analyses/search should be used instead" From version 6.3

          https://docs.sonarqube.org/display/DEV/API+Changes

          Would need to update SONAR_API_GATE to something like "/api/project_analyses/search?project=%s"

          https://github.com/jenkinsci/quality-gates-plugin/blob/master/QualityGatesPlugin/src/main/java/quality/gates/sonar/api/SonarHttpRequester.java 

          Also not sure if response has changed, sample:

          {"paging":{"pageIndex":1,"pageSize":100,"total":8},"analyses":[{"key":"AV1l0sim_SE32WwMCM85","date":"2017-07-21T11:44:43-0400","events":[

          {"key":"AV1l0s3R_SE32WwMCM86","category":"VERSION","name":"not provided"}

          ]},{"key":"AV1lyy5a_SE32WwMCM80","date":"2017-07-21T11:36:31-0400","events":[]},{"key":"AV1lwh3E_SE32WwMCM8u","date":"2017-07-21T11:26:37-0400","events":[

          {"key":"AV1lwiB7_SE32WwMCM8v","category":"QUALITY_GATE","name":"Green (was Red)","description":""}

          ]},{"key":"AV1lvLgg_SE32WwMCM8d","date":"2017-07-21T11:20:41-0400","events":[]},{"key":"AV1lm-oa_SE32WwMCM8P","date":"2017-07-21T10:44:52-0400","events":[

          {"key":"AV1lm_Bf_SE32WwMCM8Q","category":"QUALITY_PROFILE","name":"Changes in 'Sonar way' (Java)"}

          ]},{"key":"AV1kpK1D_SE32WwMCM5R","date":"2017-07-21T06:14:50-0400","events":[

          {"key":"AV1kpLIp_SE32WwMCM5S","category":"QUALITY_GATE","name":"Red (was Green)","description":"Coverage < 99"}

          ]},{"key":"AV1koOhc_SE32WwMCM5M","date":"2017-07-21T06:10:42-0400","events":[]},{"key":"AV1knVTu_SE32WwMCMy_","date":"2017-07-21T06:06:37-0400","events":[]}]}

          Show
          twex Thomas O'Reilly added a comment - - edited I'm seeing the same error. According to sonarqube docs "api/events is removed, api/project_analyses/search should be used instead" From version 6.3 https://docs.sonarqube.org/display/DEV/API+Changes Would need to update  SONAR_API_GATE  to something like " /api/project_analyses/search?project= %s" https://github.com/jenkinsci/quality-gates-plugin/blob/master/QualityGatesPlugin/src/main/java/quality/gates/sonar/api/SonarHttpRequester.java   Also not sure if response has changed, sample: {"paging":{"pageIndex":1,"pageSize":100,"total":8},"analyses":[{"key":"AV1l0sim_SE32WwMCM85","date":"2017-07-21T11:44:43-0400","events":[ {"key":"AV1l0s3R_SE32WwMCM86","category":"VERSION","name":"not provided"} ]},{"key":"AV1lyy5a_SE32WwMCM80","date":"2017-07-21T11:36:31-0400","events":[]},{"key":"AV1lwh3E_SE32WwMCM8u","date":"2017-07-21T11:26:37-0400","events":[ {"key":"AV1lwiB7_SE32WwMCM8v","category":"QUALITY_GATE","name":"Green (was Red)","description":""} ]},{"key":"AV1lvLgg_SE32WwMCM8d","date":"2017-07-21T11:20:41-0400","events":[]},{"key":"AV1lm-oa_SE32WwMCM8P","date":"2017-07-21T10:44:52-0400","events":[ {"key":"AV1lm_Bf_SE32WwMCM8Q","category":"QUALITY_PROFILE","name":"Changes in 'Sonar way' (Java)"} ]},{"key":"AV1kpK1D_SE32WwMCM5R","date":"2017-07-21T06:14:50-0400","events":[ {"key":"AV1kpLIp_SE32WwMCM5S","category":"QUALITY_GATE","name":"Red (was Green)","description":"Coverage < 99"} ]},{"key":"AV1koOhc_SE32WwMCM5M","date":"2017-07-21T06:10:42-0400","events":[]},{"key":"AV1knVTu_SE32WwMCMy_","date":"2017-07-21T06:06:37-0400","events":[]}]}
          Hide
          richardwolford Richard Wolford added a comment -

          I'm still getting this error with this plugin, how do you resolve it?

           
          [INFO] CPD calculation finished
          [INFO] Analysis report generated in 1450ms, dir size=6 MB
          [INFO] Analysis reports compressed in 4020ms, zip size=2 MB
          [INFO] Analysis report uploaded in 697ms
          [INFO] ANALYSIS SUCCESSFUL, you can browse
          http://127.0.0.1:9000/dashboard?id=gov.hud.sams%3Asams-dal
          [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
          [INFO] More about the report processing at
          http://127.0.0.1:9000/api/ce/task?id=AWRCK0dIsYWP1iz76uNv
          [INFO] Task total time: 1:37.623 s
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESS
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 02:25 min
          [INFO] Finished at: 2018-06-27T12:54:52-04:00
          [INFO] ------------------------------------------------------------------------
          Waiting for Jenkins to finish collecting data
          [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/pom.xml to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73.pom
          [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/target/sams-dal.jar to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73.jar
          [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/target/sams-dal-tests.jar to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73-tests.jar
          channel stopped
          quality.gates.jenkins.plugin.QGException: Expected status 200, got: 404. Response: {"errors":[

          {"msg":"Unknown url : /api/events"}

          ]}
          at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59)
          at quality.gates.sonar.api.SonarHttpRequester.getAPIInfo(SonarHttpRequester.java:47)
          at quality.gates.sonar.api.QualityGatesProvider.getRequesterResult(QualityGatesProvider.java:34)
          at quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:29)
          at quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:20)
          at quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:73)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
          at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1073)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
          at hudson.model.Run.execute(Run.java:1819)
          at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:429)
          Build step 'Quality Gates' marked build as failure
          Finished: FAILURE

          Show
          richardwolford Richard Wolford added a comment - I'm still getting this error with this plugin, how do you resolve it?   [INFO] CPD calculation finished [INFO] Analysis report generated in 1450ms, dir size=6 MB [INFO] Analysis reports compressed in 4020ms, zip size=2 MB [INFO] Analysis report uploaded in 697ms [INFO] ANALYSIS SUCCESSFUL, you can browse http://127.0.0.1:9000/dashboard?id=gov.hud.sams%3Asams-dal [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report [INFO] More about the report processing at http://127.0.0.1:9000/api/ce/task?id=AWRCK0dIsYWP1iz76uNv [INFO] Task total time: 1:37.623 s [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:25 min [INFO] Finished at: 2018-06-27T12:54:52-04:00 [INFO] ------------------------------------------------------------------------ Waiting for Jenkins to finish collecting data [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/pom.xml to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73.pom [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/target/sams-dal.jar to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73.jar [JENKINS] Archiving /var/lib/jenkins/workspace/TestMaven/target/sams-dal-tests.jar to gov.hud.sams/sams-dal/0.5.73/sams-dal-0.5.73-tests.jar channel stopped quality.gates.jenkins.plugin.QGException: Expected status 200, got: 404. Response: {"errors":[ {"msg":"Unknown url : /api/events"} ]} at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59) at quality.gates.sonar.api.SonarHttpRequester.getAPIInfo(SonarHttpRequester.java:47) at quality.gates.sonar.api.QualityGatesProvider.getRequesterResult(QualityGatesProvider.java:34) at quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:29) at quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:20) at quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:73) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1073) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1819) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Build step 'Quality Gates' marked build as failure Finished: FAILURE

            People

            • Assignee:
              ivanash Ivana Sh
              Reporter:
              t_yas1 Yasuhiro Takahashi
            • Votes:
              7 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: