如何一个接一个地运行参数化作业(没有参数)
我在 Jenkins 有一份工作,有 2 个参数。我想运行另一个没有参数的计划,并从该计划中根据需要多次启动现有计划。
新计划需要安排每 15 分钟运行一次(将由 Jenkins 的调度程序选项完成),该计划的代码将:
- 连接到数据库
- 获取所需的记录集
- 开始循环记录集
- 存储键/值对(现有作业的参数)
- 结束循环
完成此操作后,我需要使用存储的每个键/值对运行现有作业。我可以使用 Jenkins (使用 1.406)开箱即用地这样做吗?或者我是否必须远程调用现有作业? 在使用“构建后操作”部分(计划的配置)中的“构建其他项目”选项时,我不知道如何将参数从一个计划传递到另一个计划
谢谢
I have a job in Jenkins which has 2 params. I want to run another plan, which has no params and from that plan, launch the existing plan as many times as required.
The new plan needs to be scheduled to run each 15 minutes (will be done by Jenkins' scheduler option), the code of that plan will:
- connect to a db
- get required recordset
- start looping the recordset
- store the key/value pair (parameters for the existing job)
- end looping
Once this is done, I need to run the existing job with each key/value pair that was stored. Can I do it like this out of the box with Jenkins (using 1.406) or do I have to call the existing job remotely?
I don't see how to pass parameters from one plan to another when using the "Build other projects" option in the "Post-build Actions" section (configuration of a plan)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个参数化触发器插件,安装后,您可以在一次构建完成后触发参数化构建。
完成您想要的操作的最简单方法是安装此插件,并使用您想要构建的键/值列表构建项目一次。如果由于某种原因您需要在第一个作业完成后多次执行构建,那么您可以使用远程 API 从第一个项目开始构建。因此,您有两个选择:
选项 A
配对,为 Project1 执行的每个选项 B
http://server/job//buildWithParameters?PARAM1=Value1&PARAM2=Value2
(您需要将其替换为实际项目名称和参数名称/值)There is a Parameterized Trigger Plugin which, once installed, allows you to trigger a parameterized build after one build has finished.
The easiest way to accomplish what you want would be to install this plugin, and build the project once with the key/value list that you want to build against. If for some reason you need to execute the build multiple times after the first job completes, then you could use the remote API to start builds from your first project. So you have two options:
Option A
Option B
http://server/job/<Project2 Name>/buildWithParameters?PARAM1=Value1&PARAM2=Value2
(you will need to substitute in your actual project name and parameter names/values)