Last active
July 13, 2017 21:24
-
-
Save AlexChesters/179f6987ae0ab4c3d5c0ec464b68e9f7 to your computer and use it in GitHub Desktop.
An example of a Scripted Jenkins Pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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