84 lines
1.4 KiB
Groovy
84 lines
1.4 KiB
Groovy
#!/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
|
|
triggers {
|
|
pollSCM "* * * * *"
|
|
}
|
|
options {
|
|
timestamps()
|
|
ansiColor("xterm")
|
|
}
|
|
parameters {
|
|
booleanParam(name: "RELEASE",
|
|
description: "Build a release from current commit.",
|
|
defaultValue: false)
|
|
}
|
|
stages {
|
|
stage("Compile C++") {
|
|
agent {
|
|
docker {
|
|
image 'dockcross/linux-x64'
|
|
args "-v $JAVA_HOME:/java -v $HOME:/var/maven -v \"${env.WORKSPACE}:/workdir\""
|
|
reuseNode false
|
|
}
|
|
}
|
|
steps {
|
|
sh "./jenkins/scripts/compile.sh"
|
|
}
|
|
}
|
|
|
|
stage("Build & Deploy SNAPSHOT") {
|
|
agent {
|
|
docker {
|
|
image 'maven:3.6.3'
|
|
args '-v $HOME:/var/maven'
|
|
reuseNode true
|
|
}
|
|
}
|
|
steps {
|
|
sh "mvn -s $MVN_SET -B deploy"
|
|
}
|
|
}
|
|
|
|
stage("Release") {
|
|
agent {
|
|
docker {
|
|
image 'maven:3.6.3'
|
|
args '-v $HOME:/var/maven'
|
|
reuseNode true
|
|
}
|
|
}
|
|
when {
|
|
expression { params.RELEASE }
|
|
}
|
|
steps {
|
|
sh "mvn -s $MVN_SET -B release:prepare"
|
|
sh "mvn -s $MVN_SET -B release:perform"
|
|
}
|
|
}
|
|
stage('Deliver') {
|
|
agent {
|
|
docker {
|
|
image 'maven:3.6.3'
|
|
args '-v $HOME:/var/maven'
|
|
reuseNode true
|
|
}
|
|
}
|
|
steps {
|
|
sh './jenkins/scripts/deliver.sh'
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
deleteDir()
|
|
}
|
|
}
|
|
}
|