-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.salxml
502 lines (500 loc) · 31 KB
/
Jenkinsfile.salxml
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
// Define variables
def _user="saluser"
def _home="/home/" + _user
properties(
[
disableConcurrentBuilds()
]
)
pipeline {
parameters {
booleanParam defaultValue: params.RunSimpleSal ?:true, description: 'Run Java Simple-SAL tests?', name: 'RunSimpleSal'
booleanParam defaultValue: params.Messaging ?:true, description: 'Run SAL messaging tests?', name: 'Messaging'
booleanParam defaultValue: params.Push ?:true, description: 'Push RPMs and Jars to Nexus3 repos?', name: 'Push'
booleanParam defaultValue: params.Trigger ?:true, description: 'Trigger the DevEnv and Conda workflows?', name: 'Trigger'
booleanParam defaultValue: params.Bleed ?:false, description: 'Is this a "bleeding edge" build?', name: 'Bleed'
booleanParam defaultValue: params.Daily ?:false, description: 'Is this a Daily build?', name: 'Daily'
booleanParam defaultValue: params.Release ?:false, description: 'Is this a Release build?', name: 'Release'
string defaultValue: '', description: '', name: 'SAL_tag', trim: true
string defaultValue: '', description: '', name: 'XML_tag', trim: true
string defaultValue: '', description: '', name: 'simple_sal_tag', trim: true
text description: '''Using the Robot-Framework include tag syntax, create a space-delimited list of CSC tags (all lowercase text equal to the CSC name) with the -i switch for EACH CSC to build. The Script and Test CSCs, part of the Validate stage, are skipped by default; simply add them explicitly to this parameter to include them. Syntax:
-i csc_1 -i csc_2 ...''', name: 'csc_include_flags'
}
environment {
AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY')
NEXUS_USER = credentials('nexus_username')
NEXUS_PASS = credentials('nexus_password')
}
options {
disableConcurrentBuilds()
}
agent {
docker {
image 'ts-dockerhub.lsst.org/robotsal:kafka'
args '--network=kafka -w ' + _home +
' -e AWS_ACCESS_KEY_ID=$aws_key_id -e AWS_SECRET_ACCESS_KEY=$aws_secret_key ' +
'-e NEXUS_USER=$nexus_user -e NEXUS_PASS=$nexus_pass ' +
'-e LSST_DDS_PARTITION_PREFIX=citest -v ${WORKSPACE}:' + _home + '/repos'
label 'Node2_8CPU || CSC_Conda_Node'
}
}
stages {
stage('Bleeding Edge Build Values') {
when {
expression {
return params.Bleed
}
}
steps {
script {
BuildType = "Bleed"
SAL_Checkout = "*/develop"
XML_Checkout = "*/develop"
RFSALGEN_Checkout = "*/develop"
RFSALMSGs_Checkout = "*/develop"
if ( simple_sal_tag == "" ) {
SIMPLESAL_Checkout = "*/develop"
} else {
SIMPLESAL_Checkout = "refs/tags/" + simple_sal_tag
}
}
}
}
stage('Daily Build Values') {
when {
expression {
return params.Daily
}
}
steps {
script {
BuildType = "Daily"
SAL_Checkout = "*/main"
XML_Checkout = "*/develop"
RFSALGEN_Checkout = "*/develop"
RFSALMSGs_Checkout = "*/develop"
if ( simple_sal_tag == "" ) {
SIMPLESAL_Checkout = "*/main"
} else {
SIMPLESAL_Checkout = "refs/tags/" + simple_sal_tag
}
}
}
}
stage('Release Build Values') {
when {
expression {
return params.Release
}
}
steps {
script {
BuildType = "Release"
if ( SAL_tag == "" ) {
SAL_Checkout = "*/main"
} else {
SAL_Checkout = "refs/tags/" + SAL_tag
}
if ( XML_tag == "" ) {
XML_Checkout = "*/main"
} else {
XML_Checkout = "refs/tags/" + XML_tag
}
RFSALGEN_Checkout = "*/main"
RFSALMSGs_Checkout = "*/main"
if ( simple_sal_tag == "" ) {
SIMPLESAL_Checkout = "*/main"
} else {
SIMPLESAL_Checkout = "refs/tags/" + simple_sal_tag
}
}
}
}
stage('Pull Git repos') {
steps {
println("This is a " + BuildType + " build.")
echo "The SAL Checkout: " + SAL_Checkout
echo "The XML Checkout: " + XML_Checkout
echo "The SIMPLESAL Checkout: " + SIMPLESAL_Checkout
echo "The RFSALGEN Checkout: " + RFSALGEN_Checkout
echo "The RFSALMSGs Checkout: " + RFSALMSGs_Checkout
// Checkout the SAL, XML, and Salgenerator and SAL Messaging test repos.
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SAL_Checkout]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_sal']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_sal']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: XML_Checkout]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ts_xml']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/ts_xml']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: RFSALGEN_Checkout]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'robotframework_salgenerator']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/robotframework_salgenerator']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: RFSALMSGs_Checkout]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'robotframework_SAL']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lsst-ts/robotframework_SAL']]]
checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: SIMPLESAL_Checkout]], extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'simple_sal']], userRemoteConfigs: [[credentialsId: '14e4c262-1fb1-4b73-b395-5fe617420c85', url: 'https://github.com/lsst-camera-ccs/org-lsst-camera-simple-sal.git']]]
}
}//Git repos
stage('Setup: Define variables and create directories') {
steps {
println("The container user: " + _user);
println("The container home dir: " + _home);
println("Push build artifacts? " + params.Push);
println("Run Simple-SAL tests? " + params.RunSimpleSAL);
println("Run messaging tests? " + params.Messaging);
script {
SAL_Version = sh(returnStdout: true, script: "cd /home/saluser/repos/ts_sal && git describe |sed s/v//g").trim()
XML_Version = sh(returnStdout: true, script: "cd /home/saluser/repos/ts_xml && git describe |sed s/v//g").trim()
SAL_Version_Base = sh(returnStdout: true, script: "echo " + SAL_Version + " |cut -d '-' -f1 |sed s/v//g").trim()
XML_Version_Base = sh(returnStdout: true, script: "echo " + XML_Version + " |cut -d '-' -f1 |sed s/v//g").trim()
XML_Version_RC = sh(returnStdout: true, script: "echo " + XML_Version + " |cut -d '-' -f1,2 |sed s/v//g").trim()
SAL_Version_RC = sh(returnStdout: true, script: "echo " + SAL_Version + " |cut -d '-' -f1,2 |sed s/v//g").trim()
if (BuildType == "Release" || params.SAL_BRANCH == 'main' || params.XML_BRANCH == 'main') {
if (XML_Version_RC.contains('rc')) {
println("This is an XML RELEASE CANDIDATE build.")
// Maven and RPM release candidate artifacts simply use the version numbers.
MavenVersion = '-SNAPSHOT'
Build_Param = sh(returnStdout: true, script: "echo " + XML_Version_RC + " |cut -d '-' -f2").trim()
RPM_Version = XML_Version_Base + "~" + Build_Param + "-" + SAL_Version_Base
} else if (SAL_Version_RC.contains('rc')) {
println("This is a SAL RELEASE CANDIDATE build.")
// Maven and RPM release candidate artifacts simply use the version numbers.
MavenVersion = '-SNAPSHOT'
Build_Param = sh(returnStdout: true, script: "echo " + SAL_Version_RC + " |cut -d '-' -f2").trim()
RPM_Version = XML_Version_Base + "~" + Build_Param + "-" + SAL_Version_Base
} else {
println("This is a RELEASE build.")
// Maven and RPM release artifacts simply use the version numbers.
MavenVersion = ''
Build_Param = ''
RPM_Version = XML_Version_Base + "-" + SAL_Version_Base
}
} else {
println("This is a daily build.")
// Maven develop/daily/etc artifacts add the -SNAPSHOT string.
MavenVersion = '-SNAPSHOT'
// RPM develop/daily/etc artifacts add 'pre' and the Build Number string.
Build_Param = "post${BUILD_NUMBER}"
RPM_Version = XML_Version_Base + "~" + Build_Param + "-" + SAL_Version_Base
}
}
sh 'mkdir -pv "${WORKSPACE}/Reports"'
sh 'mkdir -pv ' + _home + '/repos/Reports'
echo "The Branch Name: ${GIT_BRANCH}"
echo "The SAL version: " + SAL_Version
echo "The SAL base version: " + SAL_Version_Base
echo "The SAL RC version: " + SAL_Version_RC
echo "The XML version: " + XML_Version
echo "The XML base version: " + XML_Version_Base
echo "The XML RC version: " + XML_Version_RC
echo "The Maven version: " + MavenVersion
echo "The RPM Version: " + RPM_Version
}
}//Define SAL & XML variables
stage('Copy XML files') {
steps {
// Move XML definition files to the SAL working directory.
sh label: 'XML files', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/*/*.xml ts_sal/test'
sh label: 'SAL Subsystems', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/SALSubsystems.xml ts_sal/test'
sh label: 'SAL Generics', script: '#!/bin/bash \n' + 'cp -v ${WORKSPACE}/ts_xml/python/lsst/ts/xml/data/sal_interfaces/SALGenerics.xml ts_sal/test'
}
}//Copy XML
stage('Install XML python library') {
steps {
sh label: 'XML library', script: '#!/bin/bash -x \n' + 'cd ts_xml && pip3.11 install -e . --ignore-installed --no-deps'
}
}//XML
stage('Validate') {
steps {
script {
if (params.csc_include_flags) {
// If only building a subset of CSCs, only run the Verify_SAL_Setup.robot suite.
// The Script or Test CSCs can still be included, if specified explicitly in params.csc_include_flags.
flags = "-i verify_sal_setup " + params.csc_include_flags
echo "The flags are: " + flags
} else {
flags = ""
}
}
// Validate the SAL/XML state using Test/Script CSCs
sh label: 'Validate', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo TS_SAL_DIR: $TS_SAL_DIR \n' +
'echo TS_XML_DIR: $TS_XML_DIR \n' +
'echo ========= Move to robotframework_salgenerator directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_salgenerator \n' +
'cd ' + _home + '/repos/robotframework_salgenerator \n' +
'pwd \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable XMLHome:' + _home + '/repos/ts_xml --variable SALInstall:' + _home + '/repos/ts_sal' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --name Validate --output VALIDATE --outputdir ' + _home + '/repos/Reports ' +
flags + ' -A ' + _home + '/repos/robotframework_salgenerator/Validate_SAL.list \n' +
'Result=$? \n' +
'if [ $Result -eq 0 ]; then echo Validation complete; else exit $Result; fi'
}
}//Validate
stage('Generate the RPMs') {
parallel {
stage('AuxTel') {
steps {
// Generate the AuxTel CSC RPMs
sh label: 'Kafka_Generation', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_salgenerator directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_salgenerator \n' +
'cd ' + _home + '/repos/robotframework_salgenerator \n' +
'pwd \n' +
'echo ========= Execute AuxTel salgenerator tests ========= \n' +
'sleep 1 \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable XMLHome:' + _home + '/repos/ts_xml --variable SALInstall:' + _home + '/repos/ts_sal' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --name AuxTel --output AUXTEL --outputdir ' + _home + '/repos/Reports ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_salgenerator/AT_SalGen.list \n' +
'exit 0'
}
}//AuxTel
stage('MainTel') {
steps {
// Generate the AuxTel CSC RPMs
sh label: 'Kafka_Generation', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_salgenerator directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_salgenerator \n' +
'cd ' + _home + '/repos/robotframework_salgenerator \n' +
'pwd \n' +
'echo ========= Execute AuxTel salgenerator tests ========= \n' +
'sleep 1 \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable XMLHome:' + _home + '/repos/ts_xml --variable SALInstall:' + _home + '/repos/ts_sal' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --name MainTel --output MAINTEL --outputdir ' + _home + '/repos/Reports ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_salgenerator/MT_SalGen.list \n' +
'exit 0'
}
}//MainTel
stage('MainTel Cameras and Mirror') {
steps {
// Generate the MT Camera and Mirror CSC RPMs
sh label: 'MT_CamMir_Generation', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_salgenerator directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_salgenerator \n' +
'cd ' + _home + '/repos/robotframework_salgenerator \n' +
'pwd \n' +
'echo ========= Execute AuxTel salgenerator tests ========= \n' +
'sleep 1 \n' +
'robot --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable XMLHome:' + _home + '/repos/ts_xml --variable SALInstall:' + _home + '/repos/ts_sal' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param +
' --name CameraMirrors --output CameraMirrors --outputdir ' + _home + '/repos/Reports ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_salgenerator/MT_CameraMirror_SalGen.list \n' +
'exit 0'
}
}//MT_CameraMirror
}//parallel
}//Generate_RPMs
stage('Register Kafka Topics') {
steps {
script {
Exec_Branch = "Register_Kafka_Topics/" + RFSALGEN_Checkout.replace("*/", "").replace("/", "%2F")
echo "The XML version: ${XML_Version_Base}"
echo "The exec branch: " + Exec_Branch
echo "The build node: " + env.NODE_NAME
build wait: true, job: Exec_Branch, parameters: [string(name: 'BUILD_NODE', value: env.NODE_NAME), string(name: 'XML_VERSION', value: XML_Version_Base)]
}
}
}//Register
stage('Run Kafka simple-sal tests') {
when {
expression {
return params.RunSimpleSal
}
}
steps {
sh label: 'Simple-SAL', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to simple-sal directory ========= \n' +
'echo cd ' + _home + '/repos/simple_sal \n' +
'cd ' + _home + '/repos/simple_sal \n' +
'echo ========= Execute Kafka simple-sal tests ========= \n' +
'mvn --no-transfer-progress -B -Dorg.lsst.sal.implementation=kafka clean install'
}
}//Kafka-simple-sal
stage('C++ Telemetry') {
steps {
sh label: 'CppTelemetry', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo ========= Execute SAL messaging tests ========= \n' +
'robot --outputdir ' + _home + '/repos/Reports --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param + ' ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_SAL/CombinedCppTelemetry_Tests.list \n' +
'exit 0'
}
}//CppTelemetry
stage('C++ Events') {
steps {
sh label: 'CppEvents', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo Start \n' +
'robot --outputdir ' + _home + '/repos/Reports --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param + ' ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_SAL/CombinedCppEvents_Tests.list \n' +
'exit 0'
}
}//CppEvents
stage('C++ Commands') {
steps {
sh label: 'CppCommands', script: '#!/bin/bash \n' + 'source ' + _home + '/.bash_profile \n' + 'set -x \n' +
'echo ========= Move to robotframework_SAL directory ========= \n' +
'echo cd ' + _home + '/repos/robotframework_SAL \n' +
'cd ' + _home + '/repos/robotframework_SAL \n' +
'echo Start \n' +
'robot --outputdir ' + _home + '/repos/Reports --variable ContInt:true -e skipped --skiponfailure DM*' +
' --variable SALVersion:' + SAL_Version + ' --variable SALVersionBase:' + SAL_Version_Base +
' --variable XMLVersion:' + XML_Version + ' --variable XMLVersionBase:' + XML_Version_Base +
' --variable SALInstall:' + _home + '/repos/ts_sal --variable XMLHome:' + _home + '/repos/ts_xml' +
' --variable MavenVersion:' + MavenVersion + ' --variable Build_Number:' + Build_Param + ' ' +
params.csc_include_flags + ' -A ' + _home + '/repos/robotframework_SAL/CombinedCppCommands_Tests.list \n' +
'exit 0'
}
}//CppCommands
stage('Push RPMs to Nexus3') {
when {
expression {
return params.Push
}
}
steps {
//Define the RPM array, then iterate to push RPMs to Nexus3
script {
//Define location for artifacts
if (params.Release) {
if (RPM_Version.contains('rc')) {
location = "release_candidates"
} else {
location = "releases"
}
} else if (params.Daily) {
location = "daily"
} else {
location = "bleed"
}
echo "The push location: " + location
array = sh(returnStdout: true, label: 'Push RPMs to Nexus3',
script: '#!/bin/bash -x\n' +
"ls ${WORKSPACE}/ts_sal/test/rpmbuild/RPMS/x86_64/ |grep -v debuginfo |grep '" + XML_Version_Base + "' |grep '" +
SAL_Version_Base + "' |grep '" + Build_Param + "' |tr '\n\r' ' '"
)
rpm_array = array.tokenize()
println rpm_array
if (rpm_array[0] == null) {
// If no RPMs found, abort build and mark as failure.
println("ERROR: No RPMs found with the given search parameters.")
} else {
// Iterate over RPMs and push to Nexus3 yum repo.
for(file in rpm_array) {
sh 'echo "=== Pushing RPM to Nexus3 yum repo ==="'
sh 'curl --write-out %{http_code} -Ss -u $NEXUS_USER:$NEXUS_PASS -T ${WORKSPACE}/ts_sal/test/rpmbuild/RPMS/x86_64/' + file + ' https://repo-nexus.lsst.org/nexus/repository/ts_yum/' + location + '/'
sh 'echo "=== CSC RPM push complete ==="'
}//for
// Push the ts_sal_utils RPM to Nexus3, if it was built.
FILE = env.WORKSPACE + '/ts_sal/test/rpmbuild/RPMS/x86_64/ts_sal_utils-' + SAL_Version + '-1.x86_64.rpm'
echo "ts_sal_utils file: " + FILE
if (fileExists(FILE)) {
sh 'echo "=== Push ts_sal_utils RPM to Nexus3 yum repo ==="'
sh 'curl --write-out %{http_code} -Ss -u $NEXUS_USER:$NEXUS_PASS -T ' + FILE +
' https://repo-nexus.lsst.org/nexus/repository/ts_yum/' + location + '/'
sh 'echo "=== ts_sal_utils RPM push complete ==="'
} else {
sh 'echo "=== No updates to ts_sal_utils ==="'
}//fileExists
}//else
}//script
}
}//Push RPMs to Nexus3
stage('Push RPMs to AWS S3 bucket') {
when {
expression {
return params.Push
}
}
steps {
sh label: 'Push RPMs to Nexus3', script: '#!/bin/bash -x\n' +
'aws --no-progress s3 cp ' + _home + '/repos/ts_sal/test/rpmbuild/RPMS/x86_64/ s3://sal-objects/' + location + ' ' +
'--acl public-read --recursive --exclude "dbsimulate/*" --exclude "salgenerator/*" \n' +
'echo "=== Pushed RPMs to S3 bucket ==="'
}
}//Push to AWS S3
stage('Push Java artifacts') {
when {
expression {
return params.Push
}
}
steps {
// Find and upload all the Java artifacts. Skip the Test CSC, as it is not a true Java CSC.
sh label: 'Java Artifacts', script: '#!/bin/bash -x\n' +
'declare -a JavaCSCs=($( xmlstarlet sel -t -m "//SALSubsystemSet/SALSubsystem/RuntimeLanguages[text()[contains(.,\'Java\')]]/../Name" -v . -n $HOME/repos/ts_xml/python/lsst/ts/xml/data/sal_interfaces/SALSubsystems.xml |sed \'/Test/d\' )) \n' +
'echo ${JavaCSCs[@]}\n' +
'for csc in ${JavaCSCs[@]}; do\n' +
'\tcd ' + _home + '/repos/ts_sal/test/maven/${csc}-' + XML_Version_Base + "_" + SAL_Version_Base + MavenVersion + ' || { echo "No Java artifacts for ${csc}"; continue; } \n' +
'\tmvn -DskipTests=true -B deploy \n' +
'done\n' +
'Result=$? \n' +
'if [ $Result -eq 0 ]; then echo "=== Java artifact uploads complete ==="; else exit $Result; fi'
}
}//Java artifacts
stage('Trigger Jobs') {
when {
allOf {
expression { return params.Trigger }
expression { return params.Bleed || params.Daily }
}
}
steps {
echo "Starting the IDL_Conda_package/develop job; SAL_Version: " + SAL_Version_Base + ", XML_Version: " + XML_Version_Base + "~" + Build_Param + ", build_type: " + BuildType + ", develop: true"
build job: 'IDL_Conda_package/develop', parameters: [string(name: 'SAL_Version', value: SAL_Version_Base), \
string(name: 'XML_Version', value: XML_Version_Base + "~" + Build_Param), \
string(name: 'build_type', value: BuildType), booleanParam(name: 'develop', value: true), \
booleanParam(name: 'buildXmlConda', value: true), \
booleanParam(name: 'buildSalObjConda', value: true), \
booleanParam(name: 'buildCSCConda', value: true)], wait: false
echo "Starting the BaseDevImage job; BuildSalobjContainer:true and BuildDevEnv:true"
build job: 'BaseDevImage', parameters: [booleanParam(name: 'BuildSalobjContainer', value: true), \
booleanParam(name: 'SalobjContainerDevelop', value: true), \
booleanParam(name: 'BuildDevEnv', value: true), \
booleanParam(name: 'DevEnvDevelop', value: true)], wait: false
}
}//TriggerJobs
}//stages
post {
always {
//Process Robot-Framework results.
sh label: 'Results', script: '#!/bin/bash \n' + 'echo "# Check for output files."\n' +
'declare -a outputs=(VALIDATE.xml AUXTEL.xml MAINTEL.xml MTCAMERA_AND_MIRROR.xml CombinedCppTelemetry.xml CombinedCppEvents.xml CombinedCppCommands.xml) \n' +
'echo ${outputs[@]}\n' +
'i=0\n echo i=$i\n' + 'for item in "${outputs[@]}"; do\n' +
'\tif test -f ' + _home + '/repos/Reports/$item; then array[$i]=' + _home + '/repos/Reports/$item; else echo ' +
_home + '/repos/Reports/$item does not exist!; fi\n' +
'\t(( i++ ))\n' + 'done\n' +
'echo ========= Generate the reports =========\n' + 'set -x \n' +
'rebot --nostatusrc --removekeywords wuks ' +
'--outputdir ' + _home + '/repos/Reports --name RPM_Generation -o rpm_output.xml -l rpm_log.html ' +
'-r rpm_report.html ${array[@]} \n' +
'echo Processing Robot-Framework results complete'
//Publish results to Jenkins.
robot onlyCritical: false, outputPath: 'Reports', logFileName: 'rpm_log.html', outputFileName: 'rpm_output.xml', reportFileName: 'rpm_report.html', passThreshold: 99.5, unstableThreshold: 99.0
}
cleanup {
deleteDir() /* clean up our workspace */
}
}//post
}//pipeline