Skip to content

Commit

Permalink
Repair SonarQube pipeline stage; #8
Browse files Browse the repository at this point in the history
  • Loading branch information
robertauer committed Mar 13, 2020
1 parent 20734a9 commit 49ed031
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ node('docker') {
}

stage('SonarQube') {

def sonarQube = new SonarQube(this, 'ces-sonar')
sonarQube.updateAnalysisResultOfPullRequestsToGitHub('sonarqube-gh-token')

sonarQube.analyzeWith(mvn)

if (!sonarQube.waitForQualityGateWebhookToBeCalled()) {
currentBuild.result = 'UNSTABLE'
def scannerHome = tool name: 'sonar-scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
withSonarQubeEnv {
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=dogu-build-lib:${env.BRANCH_NAME} -Dsonar.projectName=dogu-build-lib:${env.BRANCH_NAME}"
}
timeout(time: 2, unit: 'MINUTES') { // Needed when there is no webhook for example
def qGate = waitForQualityGate()
if (qGate.status != 'OK') {
unstable("Pipeline unstable due to SonarQube quality gate failure")
}
}
}
}
Expand Down

0 comments on commit 49ed031

Please sign in to comment.