2020-10-03 11:34:56 +02:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
// see https://jenkins.io/doc/book/pipeline/syntax/
|
|
|
|
|
|
|
|
pipeline {
|
2020-10-03 14:18:38 +02:00
|
|
|
environment {
|
|
|
|
MVN_SET = credentials('maven_settings')
|
|
|
|
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
|
|
|
|
}
|
2020-10-03 15:20:35 +02:00
|
|
|
agent any
|
2020-10-03 14:18:38 +02:00
|
|
|
triggers {
|
|
|
|
pollSCM "* * * * *"
|
|
|
|
}
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
ansiColor("xterm")
|
|
|
|
}
|
|
|
|
parameters {
|
|
|
|
booleanParam(name: "RELEASE",
|
|
|
|
description: "Build a release from current commit.",
|
|
|
|
defaultValue: false)
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage("Compile C++") {
|
2020-10-03 15:24:29 +02:00
|
|
|
agent {
|
2020-10-04 13:55:17 +02:00
|
|
|
dockerfile {
|
|
|
|
dir 'jenkins/docker'
|
|
|
|
filename 'dockerfile'
|
2020-10-04 18:42:26 +02:00
|
|
|
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
|
|
|
|
args "-v \"${workspace}/tdlight-java/src/main:/home/jenkins/output\" -v \"${workspace}/.m2:/home/jenkins/.m2\" -v \"${workspace}/.ccache:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work\""
|
2020-10-03 15:51:35 +02:00
|
|
|
reuseNode false
|
2020-10-03 15:24:29 +02:00
|
|
|
}
|
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
steps {
|
|
|
|
sh "./jenkins/scripts/compile.sh"
|
2020-10-03 14:15:58 +02:00
|
|
|
}
|
|
|
|
}
|
2020-10-03 14:08:38 +02:00
|
|
|
|
2020-10-03 14:18:38 +02:00
|
|
|
stage("Build & Deploy SNAPSHOT") {
|
2020-10-03 15:24:29 +02:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'maven:3.6.3'
|
|
|
|
args '-v $HOME:/var/maven'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
steps {
|
|
|
|
sh "mvn -s $MVN_SET -B deploy"
|
|
|
|
}
|
|
|
|
}
|
2020-10-03 11:34:56 +02:00
|
|
|
|
2020-10-03 14:18:38 +02:00
|
|
|
stage("Release") {
|
2020-10-03 15:20:35 +02:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'maven:3.6.3'
|
|
|
|
args '-v $HOME:/var/maven'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
when {
|
|
|
|
expression { params.RELEASE }
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "mvn -s $MVN_SET -B release:prepare"
|
|
|
|
sh "mvn -s $MVN_SET -B release:perform"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deliver') {
|
2020-10-03 15:20:35 +02:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'maven:3.6.3'
|
|
|
|
args '-v $HOME:/var/maven'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
steps {
|
|
|
|
sh './jenkins/scripts/deliver.sh'
|
|
|
|
}
|
2020-10-03 14:15:58 +02:00
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
2020-10-04 18:35:11 +02:00
|
|
|
dir("${workspace}/tdlight-java") {
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
/* clean up tmp directory */
|
|
|
|
dir("${workspace}@tmp") {
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
/* clean up script directory */
|
|
|
|
dir("${workspace}@script") {
|
|
|
|
deleteDir()
|
|
|
|
}
|
2020-10-03 14:15:58 +02:00
|
|
|
}
|
2020-10-03 14:18:38 +02:00
|
|
|
}
|
2020-10-03 11:34:56 +02:00
|
|
|
}
|