简体   繁体   English

Jenkins管道是否支持监视其他构建并在这些构建上触发(观察者模式)?

[英]Does Jenkins pipeline support watching other builds and triggering on these (observer pattern)?

A Jenkins pipeline is able to trigger a build of another job as a step. Jenkins流水线能够触发另一个作业的构建。

steps {
   build job: "my-downstream-job"
}

This is a push/imperative model, ie the downstream job is told to build by the upstream job. 这是一个推式/命令式模型,即上游作业告诉下游作业构建。

Does Jenkins support a pull model? Jenkins是否支持拉模型? ie I would like a job to observe one/many other jobs and start to build itself if these other jobs are triggered. 即,我希望一项工作能够观察一个/许多其他工作,并在其他这些工作被触发后开始自我构建。

The use case is to create a job that creates a template, and if that template changes by the template job triggering, all the other jobs that use this template will fire, rather than having to hardcode in all the dependencies into the template job. 用例是创建一个创建模板的作业,如果该模板因模板作业触发而发生更改,则将触发使用该模板的所有其他作业,而不必将所有依赖项硬编码到模板作业中。

you can try Build after other projects are built in downstream job. 您可以在下游Build after other projects are built尝试Build after other projects are built

For example, after Job_A is built you need Job_B to start automatically. 例如,在构建Job_A之后,您需要Job_B自动启动。 then setup the value in Job_B, and it will work. 然后在Job_B中设置该值,它将起作用。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM