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 []