I'm trying to prevent the run of branch_A while branch_B is running. So I succeeded with normal pipeline with BuildBlockerProperty , job_A stay in pending while job_B job is running. But with multibranch pipeline, it's not working.
Example for BuildBlockerProperty property for branch_A :
properties([
[
$class : 'BuildBlockerProperty',
blockLevel : 'GLOBAL',
blockingJobs : 'branch_B',
scanQueueFor : 'ALL',
useBuildBlocker: true
],
])
I saw on jenkins multibranch doc that is it possible but I don't find a way to do that. So if someone have the solution pls !
CodePudding user response:
I found the solution. When you write the branch name, you should write also the multibranch job name. Exemple :
properties([
[
$class : 'BuildBlockerProperty',
blockLevel : 'GLOBAL',
blockingJobs : 'multibranch_job_name/branch_B',
scanQueueFor : 'ALL',
useBuildBlocker: true
],
])
But I didn't find a way if you want to run the job only if no other jobs are running. If someone have an idea.