问题描述
我有一个用于部署Lambda的Jenkins Pipeline脚本.现在,用户将参数传递给作业以将其启动.我想进一步自动化作业,并创建一个流程,在该流程中,将触发作业,并通过JSON文件传递参数以启动作业.
I have a Jenkins Pipeline script being used to deploy lambdas. Right now the user passes the parameters to the job to kick it off. I want to automate the job a bit more and create a process where the job triggers and the parameters are passed via a JSON file to kick off the job.
我不清楚如何进行操作,我已经看到也许可以使用JsonSlurper,但是不确定这是否是该过程的理想解决方案.
I'm not clear on how to proceed I've seen that maybe JsonSlurper could be used, but not sure if that is the ideal solution for the process.
有人能实施一个好的解决方案吗?
Does anyone have a good solution that I could implement?
推荐答案
我建议使用GenericWebhook插件.
I would recommend the GenericWebhook Plugin.
您可以定义一个令牌,然后使用POST请求以您需要的任何JSON触发作业.如果您愿意,该插件将负责触发作业,甚至从JSON中解包变量.
You can define a token and then use a POST request to trigger the job with any JSON you need. The plugin will take care of triggering the job and even unpacking variables from the JSON if you want it to.
这篇关于从Jenkins作业传递Jenkins Pipeline参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!