2020-10-07 00:59:11 +02:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
// see https://jenkins.io/doc/book/pipeline/syntax/
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
environment {
|
|
|
|
MVN_SET = credentials('maven_settings')
|
|
|
|
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
|
|
|
|
}
|
|
|
|
agent any
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
ansiColor("xterm")
|
|
|
|
}
|
|
|
|
parameters {
|
|
|
|
booleanParam(name: "RELEASE",
|
|
|
|
description: "Build a release from current commit.",
|
|
|
|
defaultValue: false)
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage("Build & Deploy SNAPSHOT") {
|
|
|
|
agent {
|
|
|
|
docker {
|
2020-10-07 12:09:53 +02:00
|
|
|
image 'maven:3.6.3-openjdk-11'
|
2020-10-07 00:59:11 +02:00
|
|
|
args '-v $HOME:/var/maven'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "mvn -s $MVN_SET -B deploy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Release") {
|
|
|
|
agent {
|
|
|
|
docker {
|
2020-10-07 12:09:53 +02:00
|
|
|
image 'maven:3.6.3-openjdk-11'
|
2020-10-07 00:59:11 +02:00
|
|
|
args '-v $HOME:/var/maven'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
when {
|
|
|
|
expression { params.RELEASE }
|
|
|
|
}
|
|
|
|
steps {
|
2020-10-07 03:08:26 +02:00
|
|
|
sh "git config user.email \"jenkins@mchv.eu\""
|
|
|
|
sh "git config user.name \"Jenkins\""
|
2020-10-07 00:59:11 +02:00
|
|
|
sh "mvn -s $MVN_SET -DpushChanges=false -DlocalCheckout=true -DpreparationGoals=initialize release:prepare release:perform -B"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
/* clean up directory */
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|