[英]How to pass custom parameters to jenkins job (multibranch pipeline) on git push?
I have created the multibranch pipeline and using the jenkinsfile, jenkins created set of pipelines for each branches.我已经创建了多分支管道并使用 jenkinsfile,jenkins 为每个分支创建了一组管道。
Is there a way to pass custom job parameters and trigger jenkins job with bitbucket webhook?有没有办法传递自定义作业参数并使用 bitbucket webhook 触发 jenkins 作业?
My jenkins file has custom parameters like below example:我的詹金斯文件有自定义参数,如下例所示:
parameters {
string(name: "FOO", defaultValue: "bar", description: "FOO bar")
}
I want to trigger the job with custom parameters during code push event.我想在代码推送事件期间使用自定义参数触发作业。
Thank you in advance!先感谢您!
Cheers!干杯!
How about setting params based on commit message: (along the lines of)如何根据提交消息设置参数:(沿线)
commitMsg = sh(returnStdout: true, script: "git --no-pager show -s --format='%s' -1")
Then in your commit you can do whatever you want, like Finished feature. param1=this BOOL=true ...
然后在你的提交中你可以做任何你想做的事情,比如Finished feature. param1=this BOOL=true ...
Finished feature. param1=this BOOL=true ...
And in your pipeline you can parse them (not tested): Finished feature. param1=this BOOL=true ...
在您的管道中,您可以解析它们(未测试):
param1 = (commitMsg =~ /.*(param1=\S) .*]]>/)[ 0 ][ 1 ]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.