Skip to content

Instantly share code, notes, and snippets.

@junkdog
Created September 27, 2019 14:27
Show Gist options
  • Save junkdog/bb3ba923e0706ca52e460220872988a7 to your computer and use it in GitHub Desktop.
Save junkdog/bb3ba923e0706ca52e460220872988a7 to your computer and use it in GitHub Desktop.
pipeline {
agent {
docker {
image 'junkdog/mvn-3-jdk8'
// -u root for /root/.m2 to be resolved
args '-v /root/.m2:/root/.m2 -u root'
}
}
options {
skipStagesAfterUnstable()
}
triggers {
// nightly deploy job
cron('H H * * *')
}
stages {
stage ('Initialize') {
steps {
sh "echo `whoami`"
echo "USER = ${env.USER}"
echo "HOME = ${env.HOME}"
echo "PATH = ${env.PATH}"
echo "M2_HOME = ${env.M2_HOME}"
}
}
stage ('Build and Test') {
steps {
sh 'mvn integration-test -B'
}
post {
always {
junit '**/target/surefire-reports/*.xml'
archiveArtifacts allowEmptyArchive: true, artifacts: '*/target/*.jar'
}
}
}
stage('Install') {
when {
not { triggeredBy "TimerTrigger" }
}
steps {
sh 'mvn install -DskipTests -B'
}
}
stage('Deploy') {
when {
allOf {
branch 'master'
triggeredBy 'TimerTrigger'
}
}
steps {
sh 'mvn deploy -DskipTests -B'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment