Hi team,
I'm not completely sure how to open a RFE.
This need was reported by a customer of CloudBees and I wanted to share it with you as I think it is a useful one.
Let's say with have a classical pipeline with a sonar control and quality gate verification for a maven job (it could be anything else for sure even if it's not really serious to use others tools :-) ) like described in
(you'll note the erroneous code header : SonarQube Scanner for MSBuild)
node {
stage('SCM') {
}
stage('SonarQube analysis') {
withSonarQubeEnv('My SonarQube Server') {
sh 'mvn clean package sonar:sonar'
} // SonarQube taskId is automatically attached to the pipeline context
}
}
// No need to occupy a node
stage("Quality Gate"){
timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
For now qg has only a status property (
https://github.com/SonarSource/sonar-scanner-jenkins/blob/master/src/main/java/org/sonarsource/scanner/jenkins/pipeline/WaitForQualityGateStep.java#L52).
Could it be possible to have (even if simplified) an access to the summary of the failures when the result is KO ? it could be used to send an email etc ...
Cheers