Status: Resolved (View Workflow)
lockable-resources plugin: 2.0
Tested at least on:
Jenkins 2.82 on docker (with minimal setup, no extra plugins)
Jenkins 2.85 on Ubuntu (with minimal setup, no extra plugins)
Jenkins 2.86 on RHEL7 (more complex, production setup)
Locking freestyle jobs based on resources, does not work. A job that should be blocked, will be blocked for around one minute, after which it will start executing regardless if the lock holder job is still executing or not.
The behaviour started in lockable resources plugin version 2.0.
Steps to reproduce:
- Install lockable-resources plugin 2.0
- Add a lockable resource called "abcd" in Global Configuration
- Create two freestyle jobs, A and B
- Both should use the lockable resource "abcd"
- A should block for 2 minutes. Use e.g. shell step "sleep 120"
- B should block for 20 seconds. This is only so that you will have time to see, when it's executing.
- Run job A
- After A has started running (and blocking), run job B
- Observe Jenkins job queue
- First B should be blocked by A, hover on it's name and it'll tell you it's blocked by [abcd] and how much time it has waited.
- After time the wait time has risen over 60 seconds, B should now start running, even though A is still running.
- Extra: if you look at A:s and B:s console log, they'll have a line:
[lockable-resources] acquired lock on 
Code changed in jenkins
User: Aleksi Aalto
Fix locking for freestyle jobs
Freestyle jobs did not hold the resource locks properly,
as they did not record the queueProjectName to the queue.
Any blocked jobs would give up waiting after QUEUE_TIMEOUT
seconds in the queue, even if there was a job blocking.
Fix PR: https://github.com/jenkinsci/lockable-resources-plugin/pull/80