Skip to content

Instantly share code, notes, and snippets.

@AlexChesters
Last active July 13, 2017 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexChesters/179f6987ae0ab4c3d5c0ec464b68e9f7 to your computer and use it in GitHub Desktop.
Save AlexChesters/179f6987ae0ab4c3d5c0ec464b68e9f7 to your computer and use it in GitHub Desktop.
An example of a Scripted Jenkins Pipeline
node {
try {
def mvnHome
stage('Preparation') {
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
mvnHome = tool 'M3'
}
stage('Build') {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archive 'target/*.jar'
}
slackSend color: 'good', message: "$JOB_NAME - Successfully built #$BUILD_NUMBER (<$BUILD_URL|Open>)"
} catch (err) {
slackSend color: 'danger', message: "$JOB_NAME - Failed #$BUILD_NUMBER (<$BUILD_URL|Open>)"
throw(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment