jenkinsci / jenkinsci/lockable-resources-plugin
[JENKINS-61188] Lockable resources check always runs at least twice for Freestyle Project type
- Dominant language
- Java
- Stars
- 99
- Forks
- 205
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 8
Description
Scenario:
Create new Jenkins project of type Freestyle
Enable lockable resources option and provide for field Label valid label value, for example OPERA
Run build
org.jenkins.plugins.lockableresources LOGGER output

aLogger shows that check has been run 2 times, although first run should be enough as all resources were free and was acquired during 1st run
This behaviour can be reproduced also if running Groovy script
With more complex Groovy scripts it can be noticed that check sometimes runs more then 2 times although first check was successful, when it is run 2nd time it messes with resource count check, and then it is run again two more times

---
Originally reported by silvermo, imported from: Lockable resources check always runs at least twice for Freestyle Project type
Raw content of original issue
Scenario:
Create new Jenkins project of type Freestyle
Enable lockable resources option and provide for field Label valid label value, for example OPERA
Run buildorg.jenkins.plugins.lockableresources LOGGER output
aLogger shows that check has been run 2 times, although first run should be enough as all resources were free and was acquired during 1st run
This behaviour can be reproduced also if running Groovy script
With more complex Groovy scripts it can be noticed that check sometimes runs more then 2 times although first check was successful, when it is run 2nd time it messes with resource count check, and then it is run again two more times
environment
```
Jenkins 2.206 Lockable Resources 2.7
Jenkins 2.221 Lockable Resources 2.7
```
2 attachments
- [Screenshot 2020-02-23 at 01.19.49.png](https://issues.jenkins.io/secure/attachment/50390/Screenshot%202020-02-23%20at%2001.19.49.png)
> 
- [Screenshot 2020-02-23 at 01.27.07.png](https://issues.jenkins.io/secure/attachment/50389/Screenshot%202020-02-23%20at%2001.27.07.png)
> 
Contributor guide
Research direction
Reproduce the issue with a Jenkins Freestyle project using the lockable resources option and a valid label such as OPERA, then compare the org.jenkins.plugins.lockableresources logger output with the reported screenshots. Trace the resource-check flow from that build scenario; done means a successful first acquisition does not trigger unnecessary checks or corrupt resource counts, including when using Groovy scripts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100