Reputation: 398
Are there any Jenkins properties to enable concurrent builds from within a pipeline? My pipeline disables concurrent builds for one node with properties([disableConcurrentBuilds()])
and I would like to re-enable it when run on a different node.
I have tried properties([enableConcurrentBuilds()])
and properties([concurrentBuild()])
but both are invalid options.
Upvotes: 3
Views: 9662
Reputation: 11
Concurrent builds are enabled by default but if you use disableConcurrentBuild in your pipeline then it will be disabled. You can just use empty properties block as:
properties([])
Then the concurrent builds will be re-enabled.
Upvotes: 1
Reputation: 1
pipeline {
agent none
stages {
stage('sleep') {
agent any
options {
throttle(['test_4'])
}
steps {
sh "sleep 500"
echo "Done"
}
}
}
}
Upvotes: 0
Reputation: 11
While concurrent builds are enabled by default; during the pipeline execution it would be much more flexible having the ability to disable/enable concurrency.
e.g. if some specific stages may not allow concurrency but all remaining stages do.
Upvotes: 1
Reputation: 427
Concurrent builds are enabled by default. That is why the is the disableConcurrentBuilds()
function. So there is no need to add any additional code to your pipeline to enable concurrent builds.
Upvotes: 0