[Jenkins] attachmentsPattern不报错也没附件

it2024-03-25  74

1. attachmentsPattern不报错也没附件

在用Jenkins的emailext插件的时候遇到问题:

情况一:报错且无附件

pipline post { emailext ( subject: "daily build", attachmentsPattern: "/data/abc/test_*.html", body: '''${SCRIPT, template="groovy-html.template"}''', to: "example@example.com", from: "example@example.com" ) } 报错 ERROR: Error accessing files to attach: Expecting Ant GLOB pattern, but saw '/data/abc/test.html'. See http://ant.apache.org/manual/Types/fileset.html for syntax

ERROR: Error accessing files to attach: Expecting Ant GLOB pattern, but saw ‘/data/abc/test.html’. See http://ant.apache.org/manual/Types/fileset.html for syntax

情况二:不报错且无附件

pipline // 第一种 post { emailext ( subject: "daily build", attachmentsPattern: "./abc/test_*.html", body: '''${SCRIPT, template="groovy-html.template"}''', to: "example@example.com", from: "example@example.com" ) } // 第二种 post { emailext ( subject: "daily build", attachmentsPattern: "../abc/test_*.html", body: '''${SCRIPT, template="groovy-html.template"}''', to: "example@example.com", from: "example@example.com" ) }

情况三:不报错且有附件

pipline post { emailext ( subject: "daily build", attachmentsPattern: "abc/test_*.html", body: '''${SCRIPT, template="groovy-html.template"}''', to: "example@example.com", from: "example@example.com" ) }

总结:

emailext的attachmentsPattern,不能以 ../ or ./ or / 开头../ 开头发邮件的时候会报错./ or / 开头不报错,但是邮件也没附件…只能以文件/文件夹名开头
最新回复(0)