0

因为我想配置,如果我的 Sonar Qube 质量门出现状态错误,它不应该允许正文中的任何东西,但从 Jenkins Pipeline 中的电子邮件分机发送电子邮件。

 stage("Quality Gate"){
          steps{

              script{
         timeout(time: 1, unit: 'HOURS') {
             def qg = waitForQualityGate()
             if (qg.status != 'OK') {
                 error "Pipeline aborted due to quality gate failure: ${qg.status}"

         }
      }
  post {
        always {
  emailext attachmentsPattern:'Cucumber HTML Reports/$BUILD_NUMBER/cucumber-html-reports.zip' ,body:"$EMAILTEMPLATE$URLS $SONARQUBE ", mimeType: 'text/html', recipientProviders: [developers()], subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', to: ' xyz@abc.com'
            }
}
4

1 回答 1

0

您需要在 Sonar 端为您的 Jenkins master 配置 webhook,否则它将始终等待并在超时时失败。电子邮件将被发送,因为您在后期阶段对其进行了配置,参数化并具有“始终”条件

于 2020-01-23T17:34:38.190 回答