How to lock multiple stages of declarative Jenkins pipeline?

前端 未结 5 874
孤独总比滥情好
孤独总比滥情好 2020-12-23 19:30

I want to run multiple stages inside a lock within a declarative Jenkins pipeline:

pipeline {
    agent any
    stages {
        lock(resource: \'myResource\         


        
5条回答
  •  佛祖请我去吃肉
    2020-12-23 20:20

    This has been fixed.

    You can now lock multiples stages by grouping them in a parent stage, like this :

    stage('Parent') {
      options {
        lock('something')
      }
      stages {
        stage('one') {
          ...
        }
        stage('two') {
          ...
        }
      }
    }
    

    (Don't forget you need the Lockable Resources Plugin)

提交回复
热议问题