Repository navigation
Expand file tree
/
Copy pathJenkinsfile
More file actions
260 lines (260 loc) · 12.7 KB
/
Copy pathJenkinsfile
File metadata and controls
260 lines (260 loc) · 12.7 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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
@Library('jenkins-shared-libraries') _
def ENV_LOC=[:]
pipeline {
parameters {
choice(name: 'PLATFORM_FILTER', choices: ['all', 'windows-java-21-samples', 'windows-arm-java-21-samples', 'mac-arm-java-21-samples', 'rocky9-java-21-samples', 'rocky9-arm-java-21-samples'], description: 'Run on specific platform')
booleanParam defaultValue: false, description: 'Completely clean the workspace before building, including the Maven package cache', name: 'CLEAN_WORKSPACE'
booleanParam defaultValue: false, description: 'Run clean-samples', name: 'DISTCLEAN'
}
options{
buildDiscarder logRotator(artifactDaysToKeepStr: '4', artifactNumToKeepStr: '10', daysToKeepStr: '7', numToKeepStr: '10')
disableConcurrentBuilds()
timeout(time: 4, unit: "HOURS")
}
agent none
triggers {
// The job will be triggered only for the develop branch at 7am every day.
parameterizedCron(env.BRANCH_NAME == "develop-21" ? "0 7 * * *" : "")
}
stages {
stage('Matrix stage') {
matrix {
agent {
label "${NODE}"
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == env.NODE }
} }
axes {
axis {
name 'NODE'
values 'windows-java-21-samples', 'windows-arm-java-21-samples', 'mac-arm-java-21-samples', 'rocky9-java-21-samples', 'rocky9-arm-java-21-samples'
}
}
environment {
APDFL_KEY = credentials('apdfl-rlm-key')
// Job-local Maven repository; the node-wide ~/.m2 is shared with
// deploy jobs that install unreleased artifacts into it.
MAVEN_OPTS = "-Dmaven.repo.local=${WORKSPACE}/.m2repo"
}
stages {
stage('Axis'){
steps {
printPlatformNameInStep()
}
}
stage('Clean/reset Git checkout for release') {
when {
expression {
params.CLEAN_WORKSPACE
}
}
steps {
echo "Clean ${NODE}"
// Removes the package caches only on manually-triggered builds
cleanPackageCaches()
script {
// Ensure that the checkout is clean and any changes
// to .gitattributes and .gitignore have been taken
// into effect. The Maven package cache is excluded:
// cleanPackageCaches owns its removal.
if (isUnix()) {
sh """
git rm -f -q -r .
git reset --hard HEAD
git clean -fdx -e .m2repo
"""
} else {
bat """
git rm -q -r .
git reset --hard HEAD
git clean -fdx -e .m2repo
"""
}
}
}
}
stage('Set-Up Environment') {
steps {
echo "Set-Up Environment ${NODE}"
script {
if (isUnix()) {
sh 'chmod +x mkenv.py'
sh './mkenv.py --verbose'
ENV_LOC[NODE] = sh (
script: './mkenv.py --env-name',
returnStdout: true
).trim()
} else {
// Invoke through the Python Launcher (py) explicitly rather than
// relying on the .py file association, which on some Windows hosts
// does not forward arguments (%*). Without the argument, mkenv.py
// runs a full environment setup and prints pip output, corrupting
// the value captured below.
bat 'py mkenv.py --verbose'
ENV_LOC[NODE] = bat (
// The @ prevents Windows from echoing the command itself into the stdout,
// which would corrupt the value of the returned data.
script: '@py mkenv.py --env-name',
returnStdout: true
).trim()
}
}
}
}
stage('Clean Samples') {
steps {
echo "Clean ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke clean-samples
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke clean-samples
"""
}
}
}
}
stage('Clean Maven Packages Before Nightly Build') {
steps {
echo "Clean ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke clean-maven-packages
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke clean-maven-packages
"""
}
}
}
}
stage('Build Samples using Nightly packages') {
steps {
echo "Build ${NODE}"
script {
// apdfl-internal is not anonymous; tasks.py references
// these from the settings.xml it generates.
withCredentials([usernamePassword(credentialsId: 'repoflow-devauto-password',
usernameVariable: 'REPOFLOW_USER',
passwordVariable: 'REPOFLOW_PASS')]) {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke build-samples --pkg-source Nightly
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke build-samples --pkg-source Nightly
"""
}
}
}
}
}
stage('Run Samples using Nightly packages') {
steps {
echo "Running samples on ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke run-samples --pkg-source Nightly
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke run-samples --pkg-source Nightly
"""
}
}
}
}
stage('Clean Samples After Nightly Run') {
steps {
echo "Clean ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke clean-samples
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke clean-samples
"""
}
}
}
}
stage('Clean Maven Packages Before Public Build') {
steps {
echo "Clean ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke clean-maven-packages
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke clean-maven-packages
"""
}
}
}
}
stage('Build Samples using Public packages') {
steps {
echo "Build ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke build-samples --pkg-source Public
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke build-samples --pkg-source Public
"""
}
}
}
}
stage('Run Samples using Public packages') {
steps {
echo "Running samples on ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke run-samples --pkg-source Public
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke run-samples --pkg-source Public
"""
}
}
}
}
stage('Clean Samples After Public Run') {
steps {
echo "Clean ${NODE}"
script {
if (isUnix()) {
sh """. ${ENV_LOC[NODE]}/bin/activate
invoke clean-samples
"""
} else {
bat """CALL ${ENV_LOC[NODE]}\\Scripts\\activate
invoke clean-samples
"""
}
}
}
}
}
}
}
}
}