Jenkins 管道上的电子邮件插件
Email Plugin on Jenkins Pipelines
我为 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}"
}
}
}
但是我有以下错误:
执行总是post条件时出错:
java.lang.NoSuchMethodError: 在步骤 [VersionNumber, acceptGitLabMR, addGitLabMRComment, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, envVarsForTool, error, fileExists 中找不到这样的 DSL 方法 'emailext' , 查找文件, getContext, ...
我也无法配置插件本身,我不知道如何激活它,我重新启动了 Jenkins,系统没有工作,管道语法编辑器无法识别插件,有什么建议吗?
由于某种原因,我的插件文件夹中的 Jenkins 服务器有文件:email-ext.jpi.disabled 并删除该文件,管道语法编辑器开始识别插件本身......好吧,我没有 'no such DSL method emailext' 的消息了
以Marat为例进行测试
我为 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}"
}
}
}
但是我有以下错误:
执行总是post条件时出错: java.lang.NoSuchMethodError: 在步骤 [VersionNumber, acceptGitLabMR, addGitLabMRComment, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, envVarsForTool, error, fileExists 中找不到这样的 DSL 方法 'emailext' , 查找文件, getContext, ...
我也无法配置插件本身,我不知道如何激活它,我重新启动了 Jenkins,系统没有工作,管道语法编辑器无法识别插件,有什么建议吗?
由于某种原因,我的插件文件夹中的 Jenkins 服务器有文件:email-ext.jpi.disabled 并删除该文件,管道语法编辑器开始识别插件本身......好吧,我没有 'no such DSL method emailext' 的消息了
以Marat为例进行测试