How to prevent certain Jenkins jobs from running simultaneously?

后端 未结 6 622
旧巷少年郎
旧巷少年郎 2020-12-01 11:41

I have a couple of jobs that use a shared resource (database), which sometimes can cause builds to fail in the (rare) event that the jobs happen to get triggered simultaneou

6条回答
  •  时光取名叫无心
    2020-12-01 12:27

    That's an old question, but the topic can still be relevant, especially when running application tests on Jenkins.

    The Lockable Resources Plugin allows you to define lockable resources that can be used by builds. If your build requires an resource, it takes the lock. If a second build requires the same resource (which then is already locked), it will be queued for the resource to be free.

    Although the docs use computers or printers as examples for lockable resources, the database example from above should work as well.

    In opposite to the Locks and Latches Plugin mentioned in answers from 2012, this package seems to be currently maintained (currently ~2016).

提交回复
热议问题