Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locking multiple external resources in Jenkins

Is it possible to lock multiple external resources to a build in Jenkins? We have tried the External Resource Dispatcher Plugin but did not succeed.

like image 923
user2582961 Avatar asked Jul 15 '13 09:07

user2582961


People also ask

What is lock in Jenkins pipeline?

lock - the lock step throttles the number of concurrent builds in a defined section of the Pipeline. milestone - the milestone step automatically discards builds that will finish out of order and become stale.


1 Answers

It's not clear if your issue can be solved only through the External Resource Dispatcher plugin (which doesn't seem to have strong active development) but if you can afford to use the Lockable Resources Plugin as pointed by chown, there's a simplified syntax to lock multiple named resources in the Jenkins pipelines, as pointed in this support request:

pipeline {
    agent any
    options {
         // Pipeline scoped multiple resource lock
        lock(extra: [[resource: 'resa'], [resource: 'resb']])
    }
    stages {
        stage('Build') {
            steps {
                 // Stage scoped multiple resource lock
                lock(extra: [[resource: 'resc'], [resource: 'resd']])
                {
                    // ...
                }
            }
        }
    }
}
like image 80
ceztko Avatar answered Oct 01 '22 03:10

ceztko