【问题标题】:Email Plugin on Jenkins PipelinesJenkins 管道上的电子邮件插件
【发布时间】: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


    【解决方案1】:

    由于某种原因,我的插件文件夹中的 Jenkins 服务器有文件:email-ext.jpi.disabled 并删除该文件,管道语法编辑器开始识别插件本身......好吧我没有“没有这种 DSL 方法 emailext”的消息了

    以 Marat 为例进行测试 Sending a Mail on Jenkins Pipeline

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-26
      • 2020-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多