How do I prevent two pipeline jenkins jobs of the same type to run in parallel on the same node?

后端 未结 10 1948
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 02:18

I do not want to allow two jobs of the same type (same repository) to run in parallel on the same node.

How can I do this using groovy inside Jenkinsfile ?

10条回答
  •  独厮守ぢ
    2020-12-01 02:57

    The answer provided in https://stackoverflow.com/a/43963315/6839445 is deprecated.

    The current method to disable concurrent builds is to set options:

    options { disableConcurrentBuilds() }
    

    Detailed description is available here: https://jenkins.io/doc/book/pipeline/syntax/#options

提交回复
热议问题