This repository was archived by the owner on May 15, 2023. It is now read-only.
forked from izpack/izpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
90 lines (74 loc) · 1.81 KB
/
Jenkinsfile
File metadata and controls
90 lines (74 loc) · 1.81 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
pipeline {
options {
timestamps()
timeout(time: 1, unit: 'HOURS')
buildDiscarder( logRotator ( artifactDaysToKeepStr:'10',
artifactNumToKeepStr:'5',
daysToKeepStr:'10',
numToKeepStr:'5'
)
)
}
agent { docker {
image 'docker.seal-software.net/build-agent-java8'
args dockerArgs()
label 'medium'
}}
environment {
BUILDVERSION = buildVersion()
VERSION = "5.1.3-SEAL.${env.BUILD_NUMBER}"
}
stages {
stage('setup') {
steps {
printMessage("Setup")
sh 'mvn --version'
setupVersion()
}}
stage('build') {
steps {
printMessage("Building")
sh "mvn -U clean package"
}
post { always {
// Show test results in jenkins ui
junit '**/target/surefire-reports/**/*.xml'
}}
}
// stage('deploy') {
// steps {
// printMessage("Deploying")
// deploy()
// }
// }
}
post {
always {
cleanWs()
}
}
}
def printMessage(message) {
def mVersion = getVersion()
println(message + " version $mVersion")
}
def setupVersion() {
def mVersion = getVersion()
sh("mvn -B versions:set -DnewVersion=$mVersion -DgenerateBackupPoms=false")
}
def deploy() {
def mProfile = getDeployProfile()
sh("mvn -B -P$mProfile -e clean deploy -Dmaven.test.skip=true")
}
def getVersion() {
return isMaster() ? VERSION : BUILDVERSION
}
def getDeployProfile() {
return isMasterOrRelease() ? "release" : "builds"
}
def isMasterOrRelease() {
return isMaster() || env.BRANCH_NAME ==~ /^releases\/.*/ || env.BRANCH_NAME ==~ /^....Q.$/
}
def isMaster() {
return env.BRANCH_NAME == 'master'
}