小编Mar*_*s T的帖子

Jenkins可锁定资源-无需解锁即可锁定

我正在将“ Locable Resources Plugin”与Jenkins多管道功能一起使用:

lock('my-resource-name') {

}
Run Code Online (Sandbox Code Playgroud)

我遇到一种情况,我需要在一个管道中锁定资源,而在另一个管道中解锁资源。我有解决方法,但如果可能的话,我希望使用锁插件。

我像这样的东西

lock("my-resource-name")
..... 
unlock("my-resource-name)
Run Code Online (Sandbox Code Playgroud)

为什么

我正在实现canary版本,并且通过管道有3条不同的路径(我考虑了其他解决方案,例如使用输入插件暂停管道-为我提供更多的功能超出了此问题的范围)。我想在评估金丝雀时锁定/停止管道,然后在升级或回滚完成后再次对其进行解锁。省略身体lock只是为了给我java.lang.IllegalStateException: There is no body to invoke

locking jenkins canary-deployment jenkins-pipeline

4
推荐指数
1
解决办法
2506
查看次数