Open nick-rumyantsev opened 8 years ago
I see the option of adding a timeout
parameter more interesting (and simple to use) than the other approach.
BTW, please use https://issues.jenkins-ci.org to file issues on this plugin (component lockable-resources-plugin
). Thanks.
To get next free resource will be possible soon by shared groovy library. In that case you will be able to implement it. But I will try to implement it directly in the java plugin source. Because using of sleep step in the pipeline will waste our logs. That means we need new property like waitForLockTimeout.
It would be nice to have a
tryLock; body; releaseLock
execution flow in addition to an existinglock { body }
. This will allow to implement any custom resource selection logic, i.e.Until label locking is not implemented, this can help work it around:
The lock obtaining func should return some lock object and user is obliged to save its value for further releasing. Good-old try-finally to ensure that resource is released:
Alternatively we could extend existing
lock
step withtimeout
filed which limits the phase of lock obtaining. The step itself shoud returnboolean
whether it manage to acquire a lock or not: