Configuration to Check if a Master Job Turns Green, then only the Child Jobs of another Job get Executed
- Let’s assume that we have two jobs: A & B, in which Job A has the child jobs like A1, A2, and so on.
- Go to the configuration of job A and click on ‘Add build step’ dropdown. Now select “Trigger/call builds on other projects” option.
- Enter the name of job B in the text field of “Projects to build” option. This job refers to executing first when you execute job A.
- Check the checkbox “Block until the triggered projects finish their builds” so that no downstream projects will execute until the triggered job completes. Change the settings according to your requirements, as shown in the image below.
- Click on ‘Add post-build action’ dropdown and select “Trigger parameterized build on other projects’ option. (Make sure this is only for the parameterized jobs)
- Enter the child job names which you want to trigger in “Projects to build” field.
- Select the condition from “Trigger when build is”, like ‘STABLE’, ‘UNSTABLE’, etc.
- If you want to build without parameters, then deselect the checkbox ‘Trigger build without parameters’. However, if you want to build with parameters, then select the checkbox and define parameters in the respective text field, as shown in the image below.
- Now, apply the settings and trigger the master job.