How to limit Jenkins concurrent multibranch pipeline builds?

前端 未结 3 1301
猫巷女王i
猫巷女王i 2020-12-30 18:57

I am looking at limiting the number of concurrent builds to a specific number in Jenkins, leveraging the multibranch pipeline workflow but haven\'t found any good way to do

3条回答
  •  醉话见心
    2020-12-30 19:32

    Limiting concurrent builds or stages are possible with the Lockable Resources Plugin (GitHub). I always use this mechanism to ensure that no publishing/release step is executed at the same time, while normal stages can be build concurrently.

    echo 'Starting'
    lock('my-resource-name') {
      echo 'Do something here that requires unique access to the resource'
      // any other build will wait until the one locking the resource leaves this block
    }
    echo 'Finish'
    

提交回复
热议问题