How to make a Jenkins build trigger another build

2019-07-21 16:24发布

I'm trying to create two builds in Jenkins - let's call them Setup and Testing. The Setup build should pull dev code from Git and SVN and do the necessary setup on the slave (compile, etc.) to set up our application. It should run only when there are SCM changes. The Testing build should pull automated regression test code from Git, do the necessary setup on the slave to get the tests ready, and run the tests at midnight every night there are SCM changes to the dev code. I do not want the Testing job to run if there are no SCM changes to the dev code.

Here's my problem. I know how to make the Setup build only run when there are SCM changes. I know how to make the Testing build run on a schedule. What I can't seem to figure out is how to make the Setup build trigger the Testing build, but not run the Testing build until midnight. I can only make it run right away when Setup finishes, which isn't what I want (we do have real-time CI acceptance tests that run like this, but our regression suite serves a slightly different purpose).

What I think I'm looking for is a way to pass a flag, like SCM_CHANGES=TRUE, and only run Testing at its scheduled time if (SCM_CHANGES). I may be overlooking a different way of doing this, though - I'm open to suggestions.

标签: jenkins
1条回答
再贱就再见
2楼-- · 2019-07-21 16:54

Sounds like the BuildResultTrigger Plugin might solve your problem - with it, you could set up the Testing job to monitor the result of the Setup job, with a schedule for midnight, every night.

At midnight it will check if there was a new build of Setup (and the result matches a criteria), and if yes, trigger a new Testing run.

查看更多
登录 后发表回答