This repository has been archived by the owner on May 15, 2023. It is now read-only.
forked from GateNLP/gate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
80 lines (66 loc) · 1.72 KB
/
Jenkinsfile
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
pipeline {
options {
timestamps()
timeout(time: 1, unit: 'HOURS')
buildDiscarder( logRotator (
artifactDaysToKeepStr:'10',
artifactNumToKeepStr:'5',
daysToKeepStr:'10',
numToKeepStr:'5'
))
}
agent { docker {
label 'medium'
image 'docker.seal-software.net/build-agent-java11'
args dockerArgs('--network="host"')
}}
environment {
VERSION = getVersion()
PROFILE = getProfile()
}
stages {
stage('setup') {
steps {
// Do any setup here
sh 'mvn -B versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false'
}}
stage('build') {
steps {
// Services should not have to deploy anything
// to maven repos, since the only thing needed downstream
// is the installer jar
sh 'mvn --version'
sh "mvn -B -e -T4 clean install"
}
post { always {
// Show test results in jenkins ui
junit 'target/surefire-reports/**/*.xml'
}}
}
stage('deploy') {
steps {
sh("mvn -B -P$PROFILE -e deploy -Dmaven.test.skip=true")
}
}
}
post {
always {
cleanWs()
}
}
}
def getProfile() {
isMasterOrRelease() ? "release" : "builds"
}
def isMasterOrRelease() {
return isMaster() || isRelease()
}
def isMaster() {
return env.BRANCH_NAME == 'master'
}
def isRelease() {
return env.BRANCH_NAME ==~ /^releases\/.*/ || env.BRANCH_NAME ==~ /^....Q.$/
}
def getVersion() {
return isMaster() ? "9.0-SEAL-${env.BUILD_NUMBER}" : buildVersion()
}