简体   繁体   English

詹金斯:触发下游工作

[英]Jenkins: trigger a downstream job

I have 2 jobs on Jenkins: job A (the upstream job) and job B (the downstream job) that needs to be triggered after job A has finished. 我在詹金斯上有2个工作:工作A(上游工作)和工作B(下游工作),在工作A完成后需要触发。

I used to solve this problem with: configuring Trigger parameterized build on other projects set on job A and it worked perfectly fine. 我以前通过以下方法解决此问题:在作业A 设置的其他项目配置Trigger参数化的生成,并且运行良好。

The thing is, I have been told that I can not do any change to job A so I need to stop using the configuring Trigger parameterized build on other projects from job A (which I added in the past). 事实是,我被告知我无法对作业A进行任何更改,因此我需要停止作业A的其他项目上使用配置过的Trigger参数化构建 (我在过去添加了此内容)。 Is there a way to configure something in job B that will trigger the job once job A is done? 有没有一种方法可以配置作业B中的某些内容,一旦作业A完成,该内容就会触发该作业? I noticed there is an Build after other projects are built but when checking this box, job B never started... 我注意到在构建其他项目之后还有一个构建,但是在选中此框时,作业B从未启动...

Is there any other way (plugin or something else) that can help me define everything in job B? 还有其他方法(插件或其他方法)可以帮助我定义作业B中的所有内容吗?

Thanks! 谢谢!

I have not personally tried it, but there is URL Trigger Plugin . 我没有亲自尝试过,但是有URL Trigger Plugin According to the wiki page, it allows to monitor URL location for changes, and even inspect the elements of the page for changes. 根据Wiki页面,它可以监视URL位置的更改,甚至可以检查页面元素的更改。

For your Job A (that you can't change), you can still access it's status with links like: 对于您的Job A (无法更改),您仍然可以通过以下链接访问其状态:
http://<serverurl>/job/<jobAname>/lastBuild/api/json
or 要么
http://<serverurl>/job/<jobAname>/lastStableBuild/api/json

You can change the json to xml too 您也可以将json更改为xml

Alternatively, if you don't want to get involved in parsing all that output, you use simply: 另外,如果您不想参与解析所有输出,则可以简单地使用:
http://<serverurl>/job/<jobAname>/lastBuild/buildNumber
When the Job A finishes a new build, the content of the above address will change, and the URL Trigger Plugin on Job B would trigger it. Job A完成新的构建时,上述地址的内容将更改,并且Job B上的URL Trigger Plugin将触发它。

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

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