Email-ext和Workflow/Pipeline-一些令牌没有扩展? [英] Email-ext and Workflow/Pipeline - some tokens not being expanded?

查看:193
本文介绍了Email-ext和Workflow/Pipeline-一些令牌没有扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Jenkins管道作业中使用email-ext插件,但是在自由式作业中使用email-ext时我想当然的大多数令牌没有得到扩展吗?

I'm trying to use the email-ext plugin in a Jenkins pipeline job, but most of the tokens I take for granted when using email-ext in a freestyle job aren't being expanded?

例如

node {
    emailext body: '${DEFAULT_CONTENT}', mimeType: 'text/html', replyTo: '$DEFAULT_REPLYTO', subject: '${DEFAULT_SUBJECT}', to: '$DEFAULT_RECIPIENTS'
}

生成电子邮件:

主题:

$ PROJECT_NAME-版本号$ BUILD_NUMBER-$ BUILD_STATUS!

$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!

身体:

$ PROJECT_NAME-内部版本#$ BUILD_NUMBER-$ BUILD_STATUS:检查$ BUILD_URL上的控制台输出以查看结果.

$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: Check console output at $BUILD_URL to view the results.

公平地说,这是常规配置中设置的内容.但是,这些标记都不会扩展,如果我直接从工作流中使用它们,例如,也不会扩展它们.

Which are, in fairness, what is set in the general configuration. However, none of those tokens are expanded, and if I use them directly from workflow, they're not expanded either, e.g.

emailext body: '$PROJECT_NAME', mimeType: 'text/html', replyTo: '$DEFAULT_REPLYTO', subject: '${DEFAULT_SUBJECT}', to: '$DEFAULT_RECIPIENTS'

如果我能够使用$ SCRIPT引用现有的基于Groovy的电子邮件模板,那将是好的",但是这些模板也不会被扩展.

This would be 'okay' if I was able to reference my existing Groovy-based email templates using $SCRIPT, but those aren't expanded either.

很抱歉,如果我缺少非常明显的东西-我还没有太多的Pipeline经验-缺少对电子邮件扩展的支持使我无法继续前进.

Apologies if I'm missing something incredibly obvious - I don't have much experience with Pipeline yet - the lack of email-ext support has stopped me from moving across thus far.

我今天通过干净安装Jenkins 1.651,email-ext 2.41.3和Pipeline 1.14进行了测试.

I tested today by clean installing Jenkins 1.651, email-ext 2.41.3 and Pipeline 1.14.

推荐答案

令牌与AbstractBuild紧密相关,而AbstractBuild则不使用该工作流.因此,令牌目前无法正确替换.我需要修改令牌宏插件(这是令牌扩展的基础),以便它可以与Run对象一起使用,而不仅仅是AbstractBuild,但这是一个很大的任务,我还没有做任何更改.您可以使用工作流DSL生成相同的内容.

The tokens are highly tied to AbstractBuild, which workflow doesn't use. So, the tokens won't be replaced correctly right now. I need to modify the token-macro plugin (which is the basis for the token expansion) so that it will work with a Run object instead of just AbstractBuild, but this is a large task that I haven't had the change to do yet. You could generate the same content using the workflow DSL.

这篇关于Email-ext和Workflow/Pipeline-一些令牌没有扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆