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

Credentials are not working with newest Sonarqube version

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • quality-gates-plugin
    • None
    • OS: Linux Debian with Java 1.8.0_101
      Jenkins 2.2.4
      Quality Gates Plugin: 2.5
      SonarQube: 6.0

      Some days ago I reinstall all my systems to the versions under Enviroment. The problem now is, that I setup working credentials under "Jenkins / Manage / Quality Gate". (I am using the same credentials for the other sonar plugin to run the scanner, so they are correct) But for some reason I get the following Issue:

      quality.gates.jenkins.plugin.QGException: Expected status 200, got: 401. Response: 
      	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:185)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
      	at hudson.model.Run.execute(Run.java:1745)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:404)
      Build step 'Quality Gates' marked build as failure
      

      I also tested to reconfigure Sonarqube without credentials (allow anonymous): This is working.
      Using default credentials (admin/admin): Also not working

      I think the login is broken.

          [JENKINS-38101] Credentials are not working with newest Sonarqube version

          Rafael Ramos added a comment -

          The login api is changed in sonar 6.0. The new service is api/authentication/login.
          I updated in a fork - https://github.com/arkanjoms/quality-gates-plugin
          But this is not a correct way to fix the problem, because this way breakes the login to the old sonar.

          Rafael Ramos added a comment - The login api is changed in sonar 6.0. The new service is api/authentication/login. I updated in a fork - https://github.com/arkanjoms/quality-gates-plugin But this is not a correct way to fix the problem, because this way breakes the login to the old sonar.

          Allan BURDAJEWICZ added a comment - - edited

          If there is any way to retrieve the sonar version (headers or an API endpoint that do no require login) maybe this could be a simple conditional.

          In anycase, there is a solution in pipeline with waitForQualityGate.

          Allan BURDAJEWICZ added a comment - - edited If there is any way to retrieve the sonar version (headers or an API endpoint that do no require login) maybe this could be a simple conditional. In anycase, there is a solution in pipeline with waitForQualityGate .

            ivanash Ivana Sh
            geramy Colin Weber
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: