Skip to content

Instantly share code, notes, and snippets.

@dvigne
Created April 10, 2018 15:18
Show Gist options
  • Save dvigne/843cca88248622f31543de5a4932fa22 to your computer and use it in GitHub Desktop.
Save dvigne/843cca88248622f31543de5a4932fa22 to your computer and use it in GitHub Desktop.
Jenkinsfile Boilerplate Template
pipeline {
agent any
environment {
GIT_NAME = sh returnStdout: true, script: "git --no-pager show -s --format='%an' ${env.GIT_COMMIT}"
}
stages {
stage(build) {
steps {
slackSend channel: '#builds', color: 'good', message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} Started by changes from ${env.GIT_NAME}(<${env.BUILD_URL}|Open>)", teamDomain: 'teamnamehere', tokenCredentialId: 'tokenidhere'
}
}
stage(test) {
steps {
}
}
}
post {
always {
junit "tests/phpunit.xml"
deleteDir()
}
success {
slackSend channel: '#builds', color: 'good', message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} Success after ${currentBuild.durationString}(<${env.BUILD_URL}|Open>)", teamDomain: 'teamnamehere', tokenCredentialId: 'tokenidhere'
}
failure {
slackSend channel: '#builds', color: 'danger', message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} Failure after ${currentBuild.durationString}(<${env.BUILD_URL}|Open>)", teamDomain: 'teamnamehere', tokenCredentialId: 'tokenidhere'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment