【问题标题】:Token not found in emailext plugin of jenkins在 jenkins 的 emailext 插件中找不到令牌
【发布时间】:2018-09-21 06:08:45
【问题描述】:

我正在尝试使用 jenkins 中的 emailext 插件发送电子邮件。我的声明性管道的相关部分是:

post {
    always {
        emailext (
            to: 'bar@foo.com',
            subject: "${currentBuild.currentResult}: ${env.JOB_NAME} - build ${currentBuild.number}",
            body: "${FILE, path="$WORKSPACE/results/summary.txt"}"
        )
    }
}

这会导致错误:

WorkflowScript: 53: unexpected token: FILE @ line 53, column 26.
                    body: "${FILE, path="$WORKSPACE/results/summary.txt"}"

为什么令牌${FILE, path=""} 不起作用?

【问题讨论】:

    标签: jenkins jenkins-plugins jenkins-pipeline email-ext jenkins-email-ext


    【解决方案1】:

    它适用于 ' 而不是 " 用于 body 条目:

    post {
        always {
            emailext (
                to: 'bar@foo.com',
                subject: "${currentBuild.currentResult}: ${env.JOB_NAME} - build ${currentBuild.number}",
                body: '${FILE, path="$WORKSPACE/results/summary.txt"}'
            )
        }
    }
    

    【讨论】:

    • 是的,您必须使用单引号,否则 groovy 会尝试将 ${XXXX} 替换为其变量
    猜你喜欢
    • 2012-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-08
    • 2018-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多