Skip to content

Instantly share code, notes, and snippets.

@rufoa
Created May 13, 2019 02:29
Show Gist options
  • Save rufoa/2807ad19328f70dc81fec25c317661b8 to your computer and use it in GitHub Desktop.
Save rufoa/2807ad19328f70dc81fec25c317661b8 to your computer and use it in GitHub Desktop.
Jenkins [skip ci] implementation for multi-branch declarative pipeline
// change 'agent' lines as appropriate
pipeline {
agent none
stages {
stage('Run CI?') {
agent any
steps {
script {
if (sh(script: "git log -1 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]'", returnStatus: true) == 0) {
currentBuild.result = 'NOT_BUILT'
error 'Aborting because commit message contains [skip ci]'
}
}
}
}
stage('next stage') {
agent { dockerfile true }
steps {
echo 'next stage here...'
}
}
}
}
@rufoa
Copy link
Author

rufoa commented Jul 17, 2023

Thank you for that @moertel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment