-
Notifications
You must be signed in to change notification settings - Fork 18
/
Jenkinsfile
151 lines (140 loc) · 4.66 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
pipeline {
agent {
label 'worker'
}
options {
timeout(time: 30, unit: 'MINUTES')
}
tools {
maven 'Maven 3'
}
environment {
// this regex determines which branch is deployed as a snapshot
// START CUSTOM oshdb
SNAPSHOT_BRANCH_REGEX = /(^main$)/
BENCHMARK_BRANCH_REGEX = /(^main$)/
// END CUSTOM oshdb
RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)(-(RC|beta-|alpha-)[0-9]+)?$/
RELEASE_DEPLOY = false
SNAPSHOT_DEPLOY = false
}
stages {
stage('Build and Test') {
steps {
// setting up a few basic env variables like REPO_NAME and LATEST_AUTHOR
setup_basic_env()
mavenbuild('clean compile javadoc:jar source:jar verify -P jacoco,sign,git')
}
post {
failure {
rocket_buildfail()
rocket_testfail()
}
}
}
stage('Reports and Statistics') {
steps {
reports_sonar_jacoco()
}
}
stage('Deploy Snapshot') {
when {
expression {
return env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX && VERSION ==~ /.*-SNAPSHOT$/
}
}
steps {
// START CUSTOM oshdb
deploy_snapshot('clean compile javadoc:jar source:jar deploy -P sign,git,withDep')
script {
SNAPSHOT_DEPLOY = true
}
// END CUSTOM oshdb
}
post {
failure {
rocket_snapshotdeployfail()
}
}
}
stage('Deploy Release') {
when {
expression {
return VERSION ==~ RELEASE_REGEX && env.TAG_NAME ==~ RELEASE_REGEX
}
}
steps {
// START CUSTOM oshdb
deploy_release('clean compile javadoc:jar source:jar deploy -P sign,git,withDep')
script {
RELEASE_DEPLOY = true
}
// END CUSTOM oshdb
deploy_release_central('clean compile javadoc:jar source:jar deploy -P sign,git,deploy-central')
}
post {
failure {
rocket_releasedeployfail()
}
}
}
// START CUSTOM oshdb
stage('Trigger Benchmarks') {
when {
expression {
return env.BRANCH_NAME ==~ BENCHMARK_BRANCH_REGEX
}
}
steps {
build job: 'oshdb benchmarks/master', quietPeriod: 360, wait: false
}
post {
failure {
rocket_basicsend("Triggering of Benchmarks for ${REPO_NAME}-build nr. ${env.BUILD_NUMBER} *failed* on Branch - ${env.BRANCH_NAME} (<${env.BUILD_URL}|Open Build in Jenkins>). Does the benchmark job still exist?")
}
}
}
stage('Build Examples') {
when {
anyOf {
equals expected: true, actual: RELEASE_DEPLOY
equals expected: true, actual: SNAPSHOT_DEPLOY
}
}
steps {
script {
if (RELEASE_DEPLOY == true) {
build job: 'oshdb examples/oshdb-stable', quietPeriod: 360, wait: false
} else {
build job: 'oshdb examples/oshdb-snapshot', quietPeriod: 360, wait: false
}
}
}
post {
failure {
rocket_basicsend("Triggering of Examples build for ${REPO_NAME}-build nr. ${env.BUILD_NUMBER} *failed* on Branch - ${env.BRANCH_NAME} (<${env.BUILD_URL}|Open Build in Jenkins>).")
}
}
}
// END CUSTOM oshdb
stage('Check Dependencies') {
when {
expression {
if (currentBuild.number > 1) {
return (((currentBuild.getStartTimeInMillis() - currentBuild.previousBuild.getStartTimeInMillis()) > 2592000000) && (env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX)) //2592000000 30 days in milliseconds
}
return false
}
}
steps {
check_dependencies()
}
}
stage('Wrapping Up') {
steps {
encourage()
status_change()
}
}
}
}