Does Jenkins provide any functionality to achieve the following pipeline described below?
pipeline
{
agent any
options
{
when {
branch 'master'
}
disableConcurrentBuilds()
}
stages { ... }
}
I have two states for repositories which this single pipeline must manage:
The Conditional BuildStep plugin lets users add conditional logic to Freestyle jobs from within the Jenkins web UI. It does this by: Adding two types of Conditional BuildStep ("Single" and "Multiple") - these build steps contain one or more other build steps to be run when the configured condition is met.
Declarative versus Scripted Pipeline syntax Declarative and Scripted Pipelines are constructed fundamentally differently. Declarative Pipeline is a more recent feature of Jenkins Pipeline which: provides richer syntactical features over Scripted Pipeline syntax, and.
You can use the Lockable Resources Plugin to guarantee that the problematic steps do not run in parallel when on the master branch.
Something like:
stage('on master') {
when {
branch 'master'
}
steps {
lock(label: 'choose_a_label') {
// your steps
}
}
}
stage('not on master') {
when {
not {
branch 'master'
}
}
steps {
// your steps
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With