Last active
December 3, 2019 03:47
-
-
Save lvthillo/9a8b5bd84947bacc606760c86990ec04 to your computer and use it in GitHub Desktop.
Example Jenkins Maven pipeline which uses slackNotifier.groovy
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
/* import shared library */ | |
@Library('jenkins-shared-library')_ | |
pipeline { | |
agent any | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '3')) | |
} | |
parameters { | |
booleanParam(name: 'SKIP_TESTS', defaultValue: false, description: 'Check if you want to skip tests') | |
} | |
tools { | |
maven 'maven 3.5.3' | |
} | |
stages { | |
stage('Checkout Git repository') { | |
steps { | |
git branch: 'master', credentialsId: 'git-credentials' , url: 'https://github.com/lvthillo/maven-hello-world' | |
} | |
} | |
stage('Maven Build') { | |
steps { | |
sh 'mvn clean install -DskipTests=$SKIP_TESTS' | |
} | |
} | |
} | |
post { | |
always { | |
/* Use slackNotifier.groovy from shared library and provide current build result as parameter */ | |
slackNotifier(currentBuild.currentResult) | |
cleanWs() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment