lockable-resources-plugin
lockable-resources-plugin copied to clipboard
Lock resources whose names are provided by build parameters.
What feature do you want to see added?
For example, I have 3 resources A, B, C. For each of the resources, only one job can lock it. However, I hope to choose the resource to lock in the build parameters of the job. Is this easy to implement?
Things should be like the following, or something similar?
steps {
lock ('${params.LOCK_RESOURCE}') {
echo 'Hello World'
sleep 60
}
}
Upstream changes
No response
Are you interested in contributing this feature?
No response
I've been using this for years.
pipeline {
agent none
parameters {
string(name: 'device', trim: true)
}
options {
lock(resource: params.device)
}
stages {
stage('Use it') {
agent any
steps {
echo "hi"
}
}
}
}