【发布时间】:2019-09-20 16:16:37
【问题描述】:
我为 Jenkins (2.176.3) 安装了电子邮件扩展插件 (2.66) 以在管道中使用,我正在尝试以下示例: https://medium.com/@gustavo.guss/jenkins-sending-email-on-post-build-938b236545d2
pipeline {
environment {
//This variable need be tested as string
doError = '1'
}
agent any
stages {
stage('Error') {
when {
expression { doError == '1' }
}
steps {
echo "Failure"
error "failure test. It's work"
}
}
stage('Success') {
when {
expression { doError == '0' }
}
steps {
echo "ok"
}
}
}
post {
always {
echo 'I will always say Hello again!'
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}
但我有以下错误:
执行总是后置条件时出错: java.lang.NoSuchMethodError:在步骤 [VersionNumber、acceptGitLabMR、addGitLabMRComment、archive、bat、build、catchError、checkout、deleteDir、dir、dockerFingerprintFrom、dockerFingerprintRun、echo、envVarsForTool、错误、fileExists、findFiles 中找不到这样的 DSL 方法“emailext” , 获取上下文, ...
另外我无法配置插件本身,我不知道如何激活它,我重新启动了 Jenkins,系统并没有工作,管道语法编辑器无法识别插件,有什么建议吗?
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-plugins