-
-
Save harikrishna456/f39d083a52317f71d60bb19f2035087c 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