- Choose optionA if you're using pipeline plugin.
- OptionB is a little bit deprecated, but usefull if you would like to script your build execution or trigger it remotely.
(option A) Define a post action in first jobFirst recommended and simple way if your are using "Build Pipeline". Go to the first job configuration to append a post-action :
(option B) Chain it using shell scripts
NB: this option will make loosing your pipeline chain.
I recommend to use 2 small dedicated temp jobs to test it first. That would avoid to run unnecessarely long build...
- Install Build Token Root Plugin
- Define first job with parameter
- Define second job ("follower") with parameter
- Define a trigger for the follower
- Append a shell script to chain the two jobs
Install Build Token Root Plugin
Ask to your Jenkins administrator to install this plugin : Build Token Root Plugin
Wait that Jenkins reboot (required).
Define first job with parameter
Add "branch" parameter to your first job.
Define follower job with parameter
Add "branch" parameter to your second job (same as previously).
Add a shell script to echo the variable(same as previously).
Define a trigger for the follower
Add a trigger for the second job. Set a secret token here.
Append a shell script to chain the two jobs
Open the first job configuration to add the following shell script.
You will need to adapt the jenkins host value corresponding to your environment.
Launch the first job with a parameter.