Gonna probably require twiddling with the API, but it should be possible to use one of the lock plugins (throttle one e.g.).
* On the non pipeline one: use it normally
* On the pipeline one: wrap the required groovy code in a @NonCPS function to attack the plugin API and acquire the lock.
My 2 cents
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/be92093a-baa1-4f2a-86e2-8904b7834516%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
node(){
stage "test"
allocate('test')
sleep time: 15, unit: 'MINUTES'
sh "echo 'yes'" }
@NonCPS
def allocate(String resource){
throttle = new hudson.plugins.throttleconcurrents.ThrottleJobProperty(
maxConcurrentPerNode=1,
maxConcurrentTotal=1,
categories = [resource],
throttleEnabled=true,
throttleOption="category",
matrixOptions=null
)
throttle.setOwner()
throttle = null
return true
}