简体   繁体   中英

Jenkins post-build action trigger boolean parameter

I have build-pipeline job i Jenkins which goes like this

Job-1 --triggers -> Job-2 and Job-3. sometimes I want to trigger only Job-2 but not Job 3. I setup Boolean parameter ( from Parameterized Trigger Plugin) which has check boxes for "True" or "false". I have set up the boolean parameter in post-build action of Job-1 and regardless of the check box value, all of my downstream Jobs ( Job-2 and Job-3)always get triggered.

Is there a way to trigger skip some of downstream jobs using a parameter.

Above is an example, My actual pipeline has lot of jobs with using Java( maven), Powershell, Shell scripts, batch etc.

On your job3, you can use the Conditional Step plugin: https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin

In the build section, add a Conditional Step (single) using on the boolean parameter set by the job1:

  • Run: Boolean condition
  • Token: ${JOB1_BOOLEAN}

Cheers, Bruno

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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