Stopping Jenkins job in case newer one is started

后端 未结 3 1663
难免孤独
难免孤独 2021-01-04 21:12

Is it possible to specify that, in case on job (A) is triggered more than once, that previous jobs are removed from queue, and only latest one is left in queue or started if

3条回答
  •  一生所求
    2021-01-04 21:41

    I don't think this problem can be solved perfectly by only adding a groovy script before build. If the new job come in while the older has already been building(it can't check the queue, since its pre-build part has passed), the new one still has to wait.

    As I see, to achieve a preemptive job of jenkins, we need create another oversee job. This job should check that if there are new builds in the queue regularly and terminate older one if necessary.

    But create a oversee job seems complex. I also expect a perfect solution.

提交回复
热议问题