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

in Java spring boot application the coverage is showing randomly sometime 0.0% and sometime 90%

XMLWordPrintable

      def sonarServer() {
      stage('SonarQube Server') {
      mvn "org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true -Pcoverage-per-test"
      withSonarQubeEnv('sonar server')

      { mvn "org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar" }

      context="sonarqube/qualitygate"
      setBuildStatus ("${context}", 'Checking Sonarqube quality gate', 'PENDING')
      timeout(time: 1, unit: 'MINUTES') { // Just in case something goes wrong, pipeline will be killed after a timeout
      def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
      sh "echo $qg"
      if (qg.status != 'OK') {
      setBuildStatus ("${context}", "Sonarqube quality gate fail: ${qg.status}", 'FAILURE')
      error "Pipeline aborted due to quality gate failure: ${qg.status}"
      } else {
      setBuildStatus ("${context}", "Sonarqube quality gate pass: ${qg.status}", 'SUCCESS')
      }
      }
      }
      }

            ognjenb Ognjen Bubalo
            cdatt1989 chandra datt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: