How to set "Build after other projects are built" and "Poll SCM" at the same time in jenkins

I have a job for Jenkins. One of them is database related and I only want it to be built when there are changes in its sub-version. At the same time, I want it to be built after other projects. To be clearer, think that I have two projects A and B and I want B to be built after a successful build of A, only if there is a change in sub-version B. How do I set this up?

EDIT 1:

In the case where I install a build of some other project, i.e. C, is triggered as a post build action in project B, there will be no build for C unless B has SCM changes. How to solve this?

EDIT 2:

To clarify my question, I said so. I have several projects named A, B and C. I want to queue them to build because they depend on each other: A -> B -> C. But there are some considerations. B is a database project and it should only be built when there is an update in the database, otherwise it will give me some errors. Also, we have to build B to C if there is any change in SCM B; because it affects the functionality of project C. So, in simple terms, I want Jenkins to follow these steps:

  • Assembly A.
  • Check SCM file B.
  • If any changes to SCM B, build B, otherwise skip building B.
  • Build C.

Can anyone help me with this?

+3


source to share


2 answers


I would just take care of him in assignment B.

Does your workflow always run A -> B -> C.



Now in job B, use a Conditional Build Step to run a script that will check that project B has no SCM changes. If there is no change, skip the build step and continue running C. Rebuild B and continue running C.

+1


source


Downstream-Ext plugin seems to do what you are looking for. I didn't use it because I never felt the need for it. :)

Once you install it, on the job configuration page, navigate to Post-build Actions > Build other projects (extended)

. The rest of the information is shown below. I have specified my downstream job B, checked the checkbox Trigger only if downstream project has SCM changes

and selected equal in the build results dropdown, because I only want to run job B if my parent job A is always SUCCEEDS and if B has SCM (SVN, in your case ) changes.



enter image description here

+2


source







All Articles