jenkinsci / jenkinsci/lockable-resources-plugin
[JENKINS-59803] Manual Resource reservation is ignored by job waiting for that resource
- Dominant language
- Java
- Stars
- 99
- Forks
- 205
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 8
Description
If Resource is reserved from Jenkins configuration page, already running job waiting for that resource ignores the new reservation.
Create resource foo and prepare pipeline job with piece of code like this:
lock(resource: "foo", quantity: 1) {
sleep 120
}
Then perform following steps:
- Start this job twice in a row.
{{ The first build should lock the resource and start the }}sleep step{{, the second will be waiting for the resource.}} - Go to Manage Jenkins -> Configure System -> Lockable Resources Manager section and fill Reserved by field for the foo resource }}{{by some text{{ and apply the changes (you should do this within the configured sleep time in the job - 2 minutes in the example above).}}{{}}
- Wait till the first job finishes and check the second job.{{}}
Actual results:
The second job acquires the lock and continue to the sleep step.
Expected results:
The second job should stay waiting for the resource, because the resource was manually reserved!
---
Originally reported by
dahorak, imported from: Manual Resource reservation is ignored by job waiting for that resource
Raw content of original issue
If Resource is reserved from Jenkins configuration page, already running job waiting for that resource ignores the new reservation.
Create resource foo and prepare pipeline job with piece of code like this:
lock(resource: "foo", quantity: 1) {
sleep 120
}Then perform following steps:
- Start this job twice in a row.
{{ The first build should lock the resource and start the }}sleep step{{, the second will be waiting for the resource.}}
- Go to Manage Jenkins -> Configure System -> Lockable Resources Manager section and fill Reserved by field for the foo resource }}{{by some text{{ and apply the changes (you should do this within the configured sleep time in the job - 2 minutes in the example above).}}{{}}
- Wait till the first job finishes and check the second job.{{}}
Actual results:
The second job acquires the lock and continue to the sleep step.Expected results:
The second job should stay waiting for the resource, because the resource was manually reserved!
environment
```
Jenkins: 2.121.3
Lockable Resources plugin: 2.3
```
Contributor guide
Research direction
Reproduce the issue in the lockable-resources-plugin with a Jenkins pipeline using lock(resource: "foo", quantity: 1) and two builds. Then trace how the Lockable Resources Manager reservation is checked while a queued build waits. Done means a manually reserved resource keeps the waiting build blocked after the current holder finishes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100