I build my application through a Jenkins pipeline job, made a sonar analysis and then passed the quality gate, i deploy it in nexus with mvn deploy.
Initially I only wanted to publish in case of success
stage("Quality Gate"){
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
But now I want to the logic gate a bit in jenkins so that I can publish even if there's no error.(warning may come)
So I changed the jenkins stage to:
stage("Quality Gate"){
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status == 'Error') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
stage('Deploy to Nexus') {
sh "mvn deploy -DskipTests"
}
But this doesn't seem to work. the project is always pushed to nexus even if the quality gate gives error in sonarqube.
a possible workaround could be by changing the condition:
qg.status != 'OK' || qg.status != 'Warning'
Can anyone tell me the possible values for the error status.