jenkinsci / jenkinsci/lockable-resources-plugin
[JENKINS-53332] Allow picking a lockable resource from a node label
- Dominant language
- Java
- Stars
- 99
- Forks
- 205
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 8
Description
This plugin has really helped in the scenario of testing client-server, or cloud applications where we want to lock a deployment across multiple test jobs, however we end up duplicating configuration between lockable resources and node. A really useful improvement to lockable resources would be to choose the resource from online nodes in a pool represented by a node label.
For example, I currently configure:
- node label "BACKEND_POOL" representing a pool of Jenkins nodes where I can deploy my applcation back end/services
- lockable resources "SERVICE_POOL" with the identical list
Now I have a pipeline like pseudocode:
stage("Build") {
build()
}
RESOURCE = get lockable resource from SERVICE_POOL
stage ("Deploy") {
node (RESOURCE) {
deploy()
}
stage ("Test1") {
node ("Test") {
Test1(server=RESOURCE)
}
}
stage ("Test2") {
node ("Test") {
Test2 (server=RESOURCE)
}
}
However, now I am maintaining the same list of resources in both the node label/pool and the lockable resource pool. This leads to issues like nodes being locked for deployment even though they are offline, someone adding or deleting a resource from one pool but not the other, or someone taking a node offline in one place but not the other.
Lockable resources should be able to lock a resource from online nodes in a node pool, and keep it locked across multiple stages that require using that resource but not as a node.
---
Originally reported by wgc123, imported from: Allow picking a lockable resource from a node label
Raw content of original issue
This plugin has really helped in the scenario of testing client-server, or cloud applications where we want to lock a deployment across multiple test jobs, however we end up duplicating configuration between lockable resources and node. A really useful improvement to lockable resources would be to choose the resource from online nodes in a pool represented by a node label.
For example, I currently configure:
- node label "BACKEND_POOL" representing a pool of Jenkins nodes where I can deploy my applcation back end/services
- lockable resources "SERVICE_POOL" with the identical list
Now I have a pipeline like pseudocode:
stage("Build") {
build()
}
RESOURCE = get lockable resource from SERVICE_POOL
stage ("Deploy") {
node (RESOURCE) {
deploy()
}
stage ("Test1") {
node ("Test") {
Test1(server=RESOURCE)
}
}
stage ("Test2") {
node ("Test") {
Test2 (server=RESOURCE)
}
}
However, now I am maintaining the same list of resources in both the node label/pool and the lockable resource pool. This leads to issues like nodes being locked for deployment even though they are offline, someone adding or deleting a resource from one pool but not the other, or someone taking a node offline in one place but not the other.
Lockable resources should be able to lock a resource from online nodes in a node pool, and keep it locked across multiple stages that require using that resource but not as a node.
Contributor guide
Research direction
Start by tracing the lockable-resources-plugin entry points for node labels, online nodes, and Pipeline resource selection. Compare the requested BACKEND_POOL and SERVICE_POOL workflow with the existing lock behavior across Deploy, Test1, and Test2 stages. Done means a resource can be selected from eligible online nodes and remain locked across the described stages without duplicated pool configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100