Jenkins · Declarative pipeline basics

Run a stage conditionally

Skip a stage unless a condition holds.

stage('Deploy') {
  when { branch 'main' }
  steps { sh './deploy.sh' }
}

Official Jenkins documentation

More declarative pipeline basics commands

All declarative pipeline basics commands · Jenkins cheatsheet

Was this page helpful?