I also have this issue. I unlock the resource manually (after manually taking the lock), and the pipeline job is left waiting. Even if I restart Jenkins, the pipeline gets resumed properly, but it still doesn't get the updated lock status. Is there any way to update the status of it that the pipeline sees, or is there a better way of doing this that I'm not familiar with (this is my first time using this plugin)?
Here's my test pipeline:
lock('my-lock') {
echo "I got the lock!"
}
Here's what I see in the console output (resource 'my-lock' was manually reserved before triggering, but released a long time ago):
Started by user developer
[Pipeline] lock
Trying to acquire lock on [my-lock]
Found 0 available resource(s). Waiting for correct amount: 1.
[my-lock] is locked, waiting...
Resuming build at Wed Jun 27 11:20:35 UTC 2018 after Jenkins restart
<spinning wheel>
Is there something else I should be doing?
I've figured out one workaround: if I trigger another run of the job, then that will be able to take the lock successfully, then the stuck run will be able to take it after. Also, it doesn't appear to need to be a run of the same pipeline – a run of any job that requests the resource will allow the stuck pipeline to become unstuck. Maybe this is useful for you david_pamanek?
Until this works reliably, I'll likely either just create a pipeline for manually acquiring the lock, with just an input step to free it; or else have a dummy 'flush' job that takes and releases the resource, to allow any queued jobs to continue.
I also have this issue. I unlock the resource manually (after manually taking the lock), and the pipeline job is left waiting. Even if I restart Jenkins, the pipeline gets resumed properly, but it still doesn't get the updated lock status. Is there any way to update the status of it that the pipeline sees, or is there a better way of doing this that I'm not familiar with (this is my first time using this plugin)?
Here's my test pipeline:
Here's what I see in the console output (resource 'my-lock' was manually reserved before triggering, but released a long time ago):
Started by user developer [Pipeline] lock Trying to acquire lock on [my-lock] Found 0 available resource(s). Waiting for correct amount: 1. [my-lock] is locked, waiting... Resuming build at Wed Jun 27 11:20:35 UTC 2018 after Jenkins restart <spinning wheel>
Is there something else I should be doing?
I've figured out one workaround: if I trigger another run of the job, then that will be able to take the lock successfully, then the stuck run will be able to take it after. Also, it doesn't appear to need to be a run of the same pipeline – a run of any job that requests the resource will allow the stuck pipeline to become unstuck. Maybe this is useful for you david_pamanek?
Until this works reliably, I'll likely either just create a pipeline for manually acquiring the lock, with just an input step to free it; or else have a dummy 'flush' job that takes and releases the resource, to allow any queued jobs to continue.