I have a stage in Jenkins declarative pipeline that I want to run conditionally when manually triggered, and only on the master
branch.
stage('Deploy to prod') {
when {
branch 'master'
}
input {
message "Deploy to prod?"
ok "Deploy"
}
agent any
steps {
..
}
}
I'd like this stage to be skipped altogether for branches other than master
, but what happens in practice is that it gets paused for all branches. Is there a way to get the behaviour I'm after?