Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
901 views
in Technique[技术] by (71.8m points)

post - 如何在Jenkins管道后期(emailext)中添加故障的确切阶段及其错误(How to add to Jenkins pipeline post stage (emailext), the exact stage of failure and it's error)

I have the below pipeline code:

(我有以下管道代码:)

pipeline{
    agent{
        label "Ariel"
    }
    stages{
        stage ("prepare_env"){
            steps{
                script{
                    try{
                        amd_prepare_env_for_distribution()
                        }
                        catch (Exception e) {
                        echo e.toString()
                    }
                }
            }
        }  
        stage ("valdation"){
            steps{
                script{
                    amd_distribution_check_artifacts_exists credential_id: params.DISTRIBUTION_CREDENTIAL_ID, distribution_url: params.DISTRIBUTION_URL, bundle_name: params.BUNDLE_NAME, bundle_version: BUNDLE_VERSION
                }
            }
        }
        stage ("create bundle"){
            steps{
                script{
                        amd_distribution_create_bundle credential_id: params.DISTRIBUTION_CREDENTIAL_ID, distribution_url: params.DISTRIBUTION_URL, bundle_name: params.BUNDLE_NAME, bundle_version: BUNDLE_VERSION, gps_credential_id: GPG_PASSPHRASE
                }
            }
        }
    }
    post
    {
        failure {
            emailext body: 'Check console output at $BUILD_URL to view the results. 

 -------------------------------------------------- 
$', recipientProviders: [[$class: 'RequesterRecipientProvider']],
                    subject: 'Build failed in Jenkins: $PROJECT_NAME - #$BUILD_NUMBER'
        }
    }
}

how can I add to my email notification also the stage where it fails and the only the line with the error/exception?

(如何将失败的阶段和唯一带有错误/异常的行添加到我的电子邮件通知中?)

Currently, it includes only this subject with the console log URL in the body: Build failed in Jenkins: Run_Distribution_Self_Service - #708 Check console output at https://XXXXX:XXXX/job/Run_Distribution_Self_Service/708/ to view the results.

(当前,它仅在主体中包含带有控制台日志URL的该主题:在Jenkins中构建失败:Run_Distribution_Self_Service-#708在https:// XXXXX:XXXX / job / Run_Distribution_Self_Service / 708 /检查控制台输出以查看结果。)

  ask by arielma translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...