jenkinsci / jenkinsci/lockable-resources-plugin
Feature idea: new pipeline step mode to separate lock taking and releasing
- Dominant language
- Java
- Stars
- 99
- Forks
- 205
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 8
Description
### Feature Request
Currently the `lock(...) { ... }` acts on a closure, selecting a resource according to pipeline developer request and releasing it when the closure is done. This limits resource locking to be a step inside one stage.
For larger scripted pipeline jobs that would use the same locked resource instance (without a chance that someone else queued and waiting would intercept it between `lock{}` calls in different stages), it would be beneficial to have a new lock step mode that would select the resource, lock it, and return the lock object maybe the name returned into a variable like supported already, but not release the lock. Then the job can use this resource in its many stages, and finally explicitly release the lock when it is no longer needed.
(Maybe also release the lock automatically when the build ends with whatever result and reason... or maybe not, or do so optionally - in one project we did have a practical case for reserving SUT's from broken test cases for developers to investigate).
Contributor guide
Assessment
This issue has not been assessed yet.