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

waitForQualityGate() is not working if analysis is taking more than 30 seconds

XMLWordPrintable

      I am using sonar quality gate plugin to recieve the feedback about quality gate status from sonar. The problem I am currently facing is, if the time taken by sonarqube to analysis the project is less than 30 seconds, I am getting proper report else I am getting below error

      {{ Caused: java.lang.IllegalStateException: Fail to request}}
      {{ http://hostname:9000/api/ce/task?id=AWdJm6ICqOXxa2bVI8US}}
      {{ at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:212) at org.sonarqube.ws.client.HttpConnector.get(HttpConnector.java:154) at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:143) at hudson.plugins.sonar.client.HttpClient.getHttp(HttpClient.java:37) at hudson.plugins.sonar.client.WsClient.getCETask(WsClient.java:51) at}}

      Few more things to note

      • Both projects are having same settings
      • Inintially i thought its an issue with timeout and introduced a sleep time of 3 min (Project took 2 min to analyse). Still issue remains the same.

       

      Below is my Jenkins script

      stage('Sonar') {

      {{   stage('Sonar') { }}

      {{      steps { withSonarQubeEnv('localsonar', ) { }}

      {{         bat 'mvn -f ssui/core/pom.xml org.jacoco:jacoco-maven-plugin:prepare-agent clean install -Dmaven.test.skip=false -Dmaven.test.failure.ignore=false sonar:sonar' }}

      {{         } }}

      {{      }}}

         }

      {{stage("Quality Gate"){ }}

      {{   steps{ }}

      {{      script{ }}

      {{         timeout(time: 1, unit: 'HOURS') { }}

      {{            sh  "sleep 180" }}

      {{            def qg = waitForQualityGate() }}

      {{            if (qg.status != 'OK') }}{{{ }}

      {{               error "Pipeline aborted due to quality gate failure: ${qg.status}" }}

      {{             } }}

      {{          } }}

      {{       } }}

      {{      } }}

         }  

      {{}   }}

       

            arkanjoms Rafael Ramos
            arjunsreepad arjun sreepad
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: