Jenkins emailext 多个附件

标签 jenkins email-ext

我在附加多个附件时遇到问题。这些附件具有不同的格式。我已经尝试过用空格分隔附件模式。

emailext(
attachLog: true,
body: "xxxxxxxxxxxxxx",
attachmentsPattern: '**/*.fpr; **/testing.txt',
compressLog: true,
subject:.........."
to: '......'
)

最佳答案

在单引号内使用逗号分隔我通过模式“test/forEmail*, test/myPdf3*”附加了多个文件:

emailext attachmentsPattern: 'test/forEmail*, test/myPdf3*', body: '''${SCRIPT, template = "emailTest1-html.template"}''', mimeType: 'text/html', replyTo: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="177376637a7e7b2657717865733974787a" rel="noreferrer noopener nofollow">[email protected]</a>', subject: 's1', to: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="acdec6c3c2c99a989aeccac3dec882cfc3c1" rel="noreferrer noopener nofollow">[email protected]</a>'

原答案:

If you don't want to change your file names to fit a single pattern, you can copy files to a single folder in your workspace then send everything in the folder.

For example, I copied all files that I want to email to a folder called test, then I sent everything in that folder with the pattern 'test/*'

emailext attachmentsPattern: 'test/*',body: '''${SCRIPT, template = "emailTest1-html.template"}''', mimeType: 'text/html', replyTo: '[email protected]', subject: 's1', to: '[email protected]'

如果您需要如何在 Windows 托管的 jenkins 中复制文件的示例:

bat "copy \"C:\Program Files (x86)\Jenkins\jobs\${env.JOB_BASE_NAME}\builds\${env.BUILD_NUMBER}\htmlreports\Test_20Automation_20Report\TestExecutionReport_SL MIL.html\" test\TestExecutionReport_SL_MIL.html"

关于Jenkins emailext 多个附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51390078/

相关文章:

linux - Jenkinsfile ,通过使用 sh,说没有这样的文件或目录,但它存在

java - 如何在java中检索环境变量(Jenkins)

jenkins - 如何将文件从工作区外的目录复制到 Jenkins 管道中的工作区

Jenkins : Report results of intermediate [windows batch] build steps in email body

jenkins - 仅当手动触发构建时如何向请求者发送电子邮件?

junit - 如何在 Jenkins 中使用 Email-ext 获取 Junit 测试结果

continuous-integration - 在 Jenkins 中安排特定的构建目标?

jenkins - 使用 Jenkins 管道访问电子邮件分机模板中的变量

jenkins - Jenkins home 下电子邮件分机模板的新位置