Jenkins parameterized job that only queues one build

后端 未结 7 854
暖寄归人
暖寄归人 2020-12-30 03:25

Imagine a Jenkins job A which takes 1 minute to run, and job B which takes 5 minutes.

If we configure job A to trigger job B, while job B is running job A may run 5

7条回答
  •  无人及你
    2020-12-30 04:18

    Here's one workaround:

    • Create a job A2B between jobs A and B
    • Add a build step in job A2B that determines whether B is running. To achieve that, check:
      • Determine if given job is currently running using Hudson/Jenkins API
      • Python API's is_queued_or_running()
    • Finally, trigger job B from A2B only if there are no B builds queued or running (carrying the parameters through)

提交回复
热议问题