stages {
def skip_stage = 'skip'
pipeline
{
agent {
label 'master'
}
parameters {
string(name: 'skip_stage', description: 'skip stage', defaultValue: 'skip')
}
stages
{
stage("test") {
when {
expression { skip_stage != "skip" }
}
steps {
echo 'This will never run'
}
}
}
}
More when condition : https://gist.github.com/merikan/228cdb1893fca91f0663bab7b095757c