From 7525f6f31f36a17893c69b51bf8c1a1a2613e9c4 Mon Sep 17 00:00:00 2001 From: Zakaria Guennoune <83596451+zguennoune02@users.noreply.github.com> Date: Thu, 8 Jul 2021 08:54:19 +0200 Subject: [PATCH] fix (#50) --- Jenkinsfile | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 77c7cbd3..ddb9005a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,31 +44,10 @@ try { // sonarQube step to get qualityGate result stage('Quality gate') { node { - def reportFilePath = "target/sonar/report-task.txt" - def reportTaskFileExists = fileExists "${reportFilePath}" - if (reportTaskFileExists) { - echo "Found report task file" - def taskProps = readProperties file: "${reportFilePath}" - echo "taskId[${taskProps['ceTaskId']}]" - timeout(time: 10, unit: 'MINUTES') { - while (true) { - sleep 10 - def taskStatusResult = - sh(returnStdout: true, script: "curl -s -X GET -u ${authString} \'${sonarProps['sonar.host.url']}/api/ce/task?id=${taskProps['ceTaskId']}\'") - echo "taskStatusResult[${taskStatusResult}]" - def taskStatus = new JsonSlurper().parseText(taskStatusResult).task.status - echo "taskStatus[${taskStatus}]" - // Status can be SUCCESS, ERROR, PENDING, or IN_PROGRESS. The last two indicate it's - // not done yet. - if (taskStatus != "IN_PROGRESS" && taskStatus != "PENDING") { - break; - } - def qualityGate = waitForQualityGate() - if (qualityGate.status != 'OK') { - currentBuild.result = 'FAIL' - } - } - } + sleep 120 + def qualityGate = waitForQualityGate() + if (qualityGate.status != 'OK') { + currentBuild.result = 'FAIL' } if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') { error("Quality gate failure: ${qualityGate.status}.");