Skip to content

Instantly share code, notes, and snippets.

@aslafy-z
Forked from rufoa/Jenkinsfile
Last active December 13, 2023 19:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslafy-z/adb007ff50896fa5f87eef1cddf5060e to your computer and use it in GitHub Desktop.
Save aslafy-z/adb007ff50896fa5f87eef1cddf5060e to your computer and use it in GitHub Desktop.
Jenkins [skip ci] implementation for multi-branch declarative pipeline
pipeline {
...
stages {
stage('Run CI?') {
steps {
script {
if (sh(script: "git log -1 --pretty=%B | grep -F -ie '[skip ci]' -e '[ci skip]'", returnStatus: true) == 0) {
currentBuild.result = 'NOT_BUILT'
error 'Aborting because commit message contains [skip ci]'
}
}
}
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment