1
0
tdlight-java-natives-linux-.../Jenkinsfile

97 lines
2.2 KiB
Plaintext
Raw Normal View History

#!/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
options {
timestamps()
ansiColor("xterm")
}
parameters {
booleanParam(name: "RELEASE",
description: "Build a release from current commit.",
defaultValue: false)
}
stages {
2020-10-04 18:47:01 +02:00
stage("Setup workspace") {
2020-10-04 19:38:05 +02:00
agent none
2020-10-04 18:47:01 +02:00
steps {
2020-10-04 19:26:22 +02:00
sh "mkdir -p \"/var/jenkins_cache/.m2\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\""
sh "mkdir -p \"/var/jenkins_cache/.ccache\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\""
2020-10-04 22:17:27 +02:00
sh "mkdir -p \"${workspace}/tdlight-java/src/main\""
2020-10-07 03:00:19 +02:00
//sh "chown 1000:1000 -R \"${workspace}\""
//sh "chmod 771 -R \"${workspace}\""
2020-10-04 18:47:01 +02:00
}
}
2020-10-03 14:18:38 +02:00
stage("Compile C++") {
agent {
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'
2020-10-04 22:49:02 +02:00
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
2020-10-06 21:27:03 +02:00
reuseNode true
}
}
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") {
agent {
docker {
2020-10-07 01:19:23 +02:00
image 'maven:3.6.3-openjdk-11'
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 14:18:38 +02:00
stage("Release") {
2020-10-03 15:20:35 +02:00
agent {
docker {
2020-10-07 01:19:23 +02:00
image 'maven:3.6.3-openjdk-11'
2020-10-03 15:20:35 +02:00
args '-v $HOME:/var/maven'
reuseNode true
}
}
2020-10-03 14:18:38 +02:00
when {
expression { params.RELEASE }
}
steps {
2020-10-07 03:00:19 +02:00
sh "git config user.email \"jenkins@mchv.eu\""
sh "git config user.name \"Jenkins\""
sh "mvn -s $MVN_SET -DpushChanges=false -DlocalCheckout=true -DpreparationGoals=initialize release:prepare release:perform -B"
2020-10-03 14:18:38 +02:00
}
}
stage('Deliver') {
2020-10-03 15:20:35 +02:00
agent {
docker {
2020-10-07 01:19:23 +02:00
image 'maven:3.6.3-openjdk-11'
2020-10-03 15:20:35 +02:00
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-07 03:00:19 +02:00
deleteDir()
2020-10-03 14:15:58 +02:00
}
2020-10-03 14:18:38 +02:00
}
}