This is not working as I expected, and I am wondering if I am doing something wrong/operating under an incorrect assumption or if I am encountering a bug. I have this in my Jenkinsfile:
node('some_non_master_node') {
stage('Upload/Trigger') {
timeout(time: 2, unit: 'MINUTES') {
lock(env.JOB_NAME) {
When I run the job in isolation it works fine:
Trying to acquire lock on [Testing/testrepo1/master]
Lock acquired on [Testing/testrepo1/master]
...
Lock released on resource [Testing/testrepo1/master]
Finished: SUCCESS
Likewise, if I go to
https://mymaster.mycompany.com/lockable-resources/ and manually reserve the resource before starting the job, I see the timeout as expected:
Trying to acquire lock on [Testing/testrepo1/master]
[Testing/testrepo1/master] is locked, waiting...
Timeout has been exceeded
Finished: ABORTED
The unexpected behavior occurs if I manually reserve the resource before the job starts and then immediately free the resource once the "
[Testing/testrepo1/master] is locked, waiting..." message appears. The job times out instead of detecting that the resource has become available.
Am I doing something wrong/operating under a wrong assumption, or is this a bug?
Ron