stage ("SonarQube analysis") {
 options {
  timeout(time: 5, unit: 'MINUTES')
 }
 steps {
  script {
   STAGE_NAME = "SonarQube analysis"
   withSonarQubeEnv('SonarQube') {
    sh "../../../sonar-scanner/bin/sonar-scanner"
   }
   // Check whether coverage threshold is met, otherwise fail the job.
   def qualitygate = waitForQualityGate()
   if (qualitygate.status != "OK") {
    slackSend (
     color: '#F01717',
     message: "*$JOB_NAME*: <$BUILD_URL|Build #$BUILD_NUMBER>, '$STAGE_NAME' stage failed."
    )
    error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
   }
  }
 }
}try {
// some stages for the workflow
}
catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e){
}--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/-ifvFnu_Un4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7b34bb58-d0e0-4d38-8d47-eff33f4839c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
pipeline {  agent any  options {    timeout(time: 1, unit: 'SECONDS')   }  stages {    ...  }  post {     failure {       // Catch failures and even the tiemout one    }  }}