forked from eclipse-ditto/ditto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_multibranch_pipeline
executable file
·61 lines (60 loc) · 2.12 KB
/
Jenkinsfile_multibranch_pipeline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!groovy
pipeline {
agent {
label "$DITTO_BUILD_NODE"
}
parameters {
string(name: 'EXTRA_MAVEN_ARGS', defaultValue: '', description: 'Additional maven arguments.')
}
environment {
// Need to replace the '%2F' used by Jenkins to deal with / in the path (e.g. story/...)
theBranch = "${env.BRANCH_NAME}".replace("%2F", "-").replace("/", "-")
theVersion = "0-${theBranch}-SNAPSHOT"
theMvnRepo = "$WORKSPACE/../../.m2/feature-repository-${theBranch}"
JAVA_TOOL_OPTIONS = '-Duser.home=/home/jenkins-slave'
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
timeout(time: 1, unit: 'HOURS')
}
stages {
stage('Clean workspace and create local maven repository') {
steps {
echo 'Clean workspace'
cleanWs()
echo "Create local maven repository"
sh "mkdir -p ${theMvnRepo}"
}
}
stage('Checkout scm') {
steps {
echo 'Checkout scm'
checkout scm
}
}
stage('Build') {
agent {
docker {
args "$DITTO_DOCKER_ARGUMENTS"
image "$DITTO_DOCKER_IMAGE_MAVEN_JDK_11"
reuseNode true
}
}
steps {
configFileProvider([configFile(fileId: 'mvn-bdc-settings', variable: 'MVN_SETTINGS')]) {
sh "mvn -s $MVN_SETTINGS clean deploy source:jar " +
"-T1C --batch-mode --errors " +
"-Pbuild-documentation,ditto " +
"-Drevision=${theVersion} " +
"${params.EXTRA_MAVEN_ARGS ?: ''}"
}
}
post {
always {
junit "**/**/target/surefire-reports/*.xml,**/**/**/target/surefire-reports/*.xml,**/**/**/target/failsafe-reports/*.xml,**/**/target/failsafe-reports/*.xml"
}
}
}
}
}