-
Notifications
You must be signed in to change notification settings - Fork 46
/
Jenkinsfile
622 lines (619 loc) · 29.1 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
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
library 'magic-butler-catalogue'
def PROJECT_NAME = 'logdna-agent-v2'
def TRIGGER_PATTERN = '.*@logdnabot.*'
def publishGCRImage = false
def publishDockerhubICRImages = false
def slugify(str) {
def s = str.toLowerCase()
s = s.replaceAll(/[^a-z0-9\s-\/]/, "").replaceAll(/\s+/, " ").trim()
s = s.replaceAll(/[\/\s]/, '-').replaceAll(/-{2,}/, '-')
s
}
pipeline {
agent {
node {
label "rust-x86_64"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}")
}
}
options {
timeout time: 8, unit: 'HOURS'
timestamps()
ansiColor 'xterm'
}
triggers {
issueCommentTrigger(TRIGGER_PATTERN)
parameterizedCron(env.BRANCH_NAME ==~ /\d+\.\d+/ ? '''
H 8 * * 1 % PUBLISH_GCR_IMAGE=true;PUBLISH_ICR_IMAGE=true;AUDIT=false;TASK_NAME=image-vulnerability-update
H 12 * * 1 % AUDIT=true;TASK_NAME=audit
''' : ''
)
}
environment {
RUST_IMAGE_REPO = 'us.gcr.io/logdna-k8s/rust'
RUST_IMAGE_TAG = 'bullseye-1-stable'
TOOLS_IMAGE_TAG = 'bullseye-1-stable'
SCCACHE_BUCKET = 'logdna-sccache-us-west-2'
SCCACHE_REGION = 'us-west-2'
CARGO_INCREMENTAL = 'false'
DOCKER_BUILDKIT = '1'
REMOTE_BRANCH = "${env.BRANCH_NAME}"
BUILD_SLUG = slugify("${BUILD_TAG}")
}
parameters {
booleanParam(name: 'PUBLISH_GCR_IMAGE', description: 'Publish docker image to Google Container Registry (GCR)', defaultValue: false)
booleanParam(name: 'PUBLISH_ICR_IMAGE', description: 'Publish docker image to IBM Container Registry (ICR) and Dockerhub', defaultValue: false)
booleanParam(name: 'PUBLISH_BINARIES', description: 'Publish executable binaries to S3 bucket s3://logdna-agent-build-bin', defaultValue: false)
booleanParam(name: 'PUBLISH_INSTALLERS', description: 'Publish Choco installer', defaultValue: false)
booleanParam(name: 'AUDIT', description: 'Check for application vulnerabilities with cargo audit', defaultValue: true)
string(name: 'RUST_IMAGE_SUFFIX', description: 'Build image tag suffix', defaultValue: "")
choice(name: 'TASK_NAME', choices: ['n/a', 'audit', 'image-vulnerability-update'], description: 'The name of the task being handled in this build, if applicable')
}
stages {
stage('Validate PR Source') {
when {
expression { env.CHANGE_FORK }
not {
triggeredBy 'issueCommentCause'
}
}
steps {
error("A maintainer needs to approve this PR for CI by commenting")
}
}
stage('Init QEMU') {
steps {
sh "make init-qemu"
}
}
stage('Vendor') {
steps {
sh """
mkdir -p .cargo || /bin/true
make vendor
"""
}
}
stage('Lint, Audit, and Unit Test') {
parallel {
stage('Lint') {
steps {
sh '''
make lint -o lint-audit
'''
}
}
stage('Audit') {
when {
environment name: 'AUDIT', value: 'true'
}
steps {
sh '''
make lint-audit
'''
}
}
/*
stage('Mac OSX Unit Tests'){
when {
not {
triggeredBy 'ParameterizedTimerTriggerCause'
}
}
agent {
node {
label "osx-node"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}")
}
}
steps {
sh """
source $HOME/.cargo/env
cargo make unit-tests
"""
}
post {
always {
sh "cargo clean"
sh "rm -f ${WORKSPACE}/.aws_creds_mac_static_arm64"
}
}
}
*/
stage('Unit Tests'){
when {
not {
triggeredBy 'ParameterizedTimerTriggerCause'
}
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
make -j2 test
"""
}
}
}
stage('Code Coverage'){
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
make unit-code-coverage
"""
}
}
post {
// Publish HTML code coverage report
success {
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: "target/llvm-cov/html",
reportFiles: 'index.html',
reportName: 'Code Coverage Report',
reportTitles: 'Mezmo Agent Code Coverage'
])
}
}
}
}
}
stage('Test') {
when {
not {
triggeredBy 'ParameterizedTimerTriggerCause'
}
}
environment {
CREDS_FILE = credentials('pipeline-e2e-creds')
LOGDNA_HOST = "logs.use.stage.logdna.net"
}
parallel {
stage('Integration Tests'){
steps {
script {
def creds = readJSON file: CREDS_FILE
// Assumes the pipeline-e2e-creds format remains the same. Chase
// refer to the e2e tests's README's authorization docs for the
// current structure
LOGDNA_INGESTION_KEY = creds["packet-stage"]["account"]["ingestionkey"]
TEST_THREADS = sh (script: 'threads=$(echo $(nproc)/4 | bc); echo $(( threads > 1 ? threads: 1))', returnStdout: true).trim()
}
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
TEST_THREADS="${TEST_THREADS}" make integration-test LOGDNA_INGESTION_KEY=${LOGDNA_INGESTION_KEY}
"""
}
}
}
/*
stage('Mac OSX Integration Tests'){
agent {
node {
label "osx-node"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}")
}
}
environment {
CREDS_FILE = credentials('pipeline-e2e-creds')
LOGDNA_HOST = "logs.use.stage.logdna.net"
}
steps {
script {
def creds = readJSON file: CREDS_FILE
LOGDNA_INGESTION_KEY = creds["packet-stage"]["account"]["ingestionkey"]
}
sh """
source $HOME/.cargo/env
LOGDNA_INGESTION_KEY=${LOGDNA_INGESTION_KEY} LOGDNA_HOST=${LOGDNA_HOST} cargo make int-tests
"""
}
post {
always {
sh "cargo clean"
}
}
}
*/
stage('Run K8s Integration Tests') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh """
echo "[default]" > ${WORKSPACE}/.aws_creds_k8s-test
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_k8s-test
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_k8s-test
make k8s-test AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_k8s-test
"""
}
}
}
}
post {
always {
sh "make clean"
sh "rm -f ${WORKSPACE}/.aws_creds_k8s-test"
}
}
}
stage('Build Release Binaries') {
environment {
CREDS_FILE = credentials('pipeline-e2e-creds')
LOGDNA_HOST = "logs.use.stage.logdna.net"
}
parallel {
stage('Build Release Image x86_64') {
steps {
sh "make init-qemu"
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
echo "[default]" > ${WORKSPACE}/.aws_creds_x86_64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_x86_64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_x86_64
ARCH=x86_64 make build-image AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_x86_64
ARCH=x86_64 make build-stress-test-image AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_x86_64
"""
}
}
post {
always {
sh "rm ${WORKSPACE}/.aws_creds_x86_64"
}
}
}
stage('Build Release Image aarch64') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
echo "[default]" > ${WORKSPACE}/.aws_creds_aarch64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_aarch64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_aarch64
ARCH=aarch64 make build-image AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_aarch64
ARCH=aarch64 make build-stress-test-image AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_aarch64
"""
}
}
post {
always {
sh "rm ${WORKSPACE}/.aws_creds_aarch64"
}
}
}
stage('Build static release binary x86_64') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
echo "[default]" > ${WORKSPACE}/.aws_creds_static_x86_64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_static_x86_64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_static_x86_64
ARCH=x86_64 STATIC=1 FEATURES= make build-release AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_static_x86_64
rm ${WORKSPACE}/.aws_creds_static_x86_64
'''
}
}
}
stage('Build static release binary aarch64') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
echo "[default]" > ${WORKSPACE}/.aws_creds_static_aarch64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_static_aarch64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_static_aarch64
ARCH=aarch64 STATIC=1 FEATURES= make build-release AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_static_aarch64
rm ${WORKSPACE}/.aws_creds_static_aarch64
'''
}
}
}
stage('Build Windows release binary x86_64') {
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
echo "[default]" > ${WORKSPACE}/.aws_creds_win_static_x86_64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_win_static_x86_64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_win_static_x86_64
ARCH=x86_64 WINDOWS=1 FEATURES=windows_service make build-release AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_win_static_x86_64
rm ${WORKSPACE}/.aws_creds_win_static_x86_64
'''
}
}
}
/*
stage('Build Mac OSX release binary X86_64') {
agent {
node {
label "osx-node"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}/x86")
}
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
source $HOME/.cargo/env
source ~/.bash_profile
echo "[default]" > ${WORKSPACE}/.aws_creds_mac_static_x86_64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_mac_static_x86_64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_mac_static_x86_64
MACOSX_DEPLOYMENT_TARGET=10.14 cargo build --release --target=x86_64-apple-darwin --target-dir x86-target
'''
}
}
post {
always {
sh "cargo clean"
sh "rm -f ${WORKSPACE}/.aws_creds_mac_static_x86_64"
}
}
}
stage('Build Mac OSX release binary ARM64') {
agent {
node {
label "osx-node"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}/arm")
}
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
source $HOME/.cargo/env
source ~/.bash_profile
echo "[default]" > ${WORKSPACE}/.aws_creds_mac_static_arm64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_mac_static_arm64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_mac_static_arm64
MACOSX_DEPLOYMENT_TARGET=10.14 cargo build --release --target-dir arm-target
'''
}
}
post {
always {
sh "cargo clean"
sh "rm -f ${WORKSPACE}/.aws_creds_mac_static_arm64"
}
}
}
*/
}
}
stage('Check Publish Images') {
stages {
stage('Scanning Images') {
steps {
sh 'ARCH=x86_64 make sysdig_secure_images'
script {
def imageNames = readFile('sysdig_secure_images').trim().split('\n')
for(img in imageNames){
echo "Scanning image ${img}"
sysdigImageScan engineCredentialsId: 'sysdig-secure-api-token', imageName: img
}
}
sh 'ARCH=aarch64 make sysdig_secure_images'
script {
def imageNames = readFile('sysdig_secure_images').trim().split('\n')
for(img in imageNames){
echo "Scanning image ${img}"
sysdigImageScan engineCredentialsId: 'sysdig-secure-api-token', imageName: img
}
}
}
}
/*
stage('Publish MAC binaries to S3') {
when {
anyOf {
branch pattern: "\\d\\.\\d.*", comparator: "REGEXP"
environment name: 'PUBLISH_BINARIES', value: 'true'
}
}
agent {
node {
label "osx-node"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}")
}
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh """
source $HOME/.cargo/env
source ~/.bash_profile
echo "[default]" > ${WORKSPACE}/.aws_creds_mac_static_arm64
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_mac_static_arm64
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_mac_static_arm64
MACOS=1 make publish-s3-binary
rm ${WORKSPACE}/.aws_creds_mac_static_arm64
"""
}
}
}
*/
stage('Publish GCR images') {
when {
environment name: 'PUBLISH_GCR_IMAGE', value: 'true'
}
steps {
// Publish to gcr, jenkins is logged into gcr globally
sh 'ARCH=x86_64 make publish-image-gcr'
sh 'ARCH=aarch64 make publish-image-gcr'
sh 'make publish-image-multi-gcr'
sh 'ARCH=x86_64 make publish-stress-test-image-gcr'
sh 'ARCH=aarch64 make publish-stress-test-image-gcr'
sh 'make publish-stress-test-image-multi-gcr'
}
}
stage('Publish Dockerhub and ICR images') {
when {
environment name: 'PUBLISH_ICR_IMAGE', value: 'true'
}
steps {
script {
// Login and publish to dockerhub
docker.withRegistry(
'https://index.docker.io/v1/',
'dockerhub-username-password'
) {
sh 'ARCH=x86_64 make publish-image-docker'
sh 'ARCH=aarch64 make publish-image-docker'
sh 'make publish-image-multi-docker'
sh 'ARCH=x86_64 make publish-stress-test-image-docker'
sh 'ARCH=aarch64 make publish-stress-test-image-docker'
sh 'make publish-stress-test-image-multi-docker'
}
// Login and publish to ibm
docker.withRegistry(
'https://icr.io',
'icr-iam-username-password'
) {
sh 'ARCH=x86_64 make publish-image-ibm'
sh 'ARCH=aarch64 make publish-image-ibm'
sh 'make publish-image-multi-ibm'
//sh 'ARCH=x86_64 make publish-stress-test-image-ibm'
//sh 'ARCH=aarch64 make publish-stress-test-image-ibm'
//sh 'make publish-stress-test-image-multi-ibm'
}
}
}
}
stage('Publish Linux and Windows binaries to S3') {
when {
anyOf {
branch pattern: "\\d\\.\\d.*", comparator: "REGEXP"
environment name: 'PUBLISH_BINARIES', value: 'true'
}
}
environment {
CSC_PASS = credentials('chocolatey-api-token')
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh '''
echo "[default]" > ${WORKSPACE}/.aws_creds_static
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> ${WORKSPACE}/.aws_creds_static
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ${WORKSPACE}/.aws_creds_static
STATIC=1 make publish-s3-binary
WINDOWS=1 make publish-s3-binary
WINDOWS=1 make msi-release
WINDOWS=1 make test-msi-release
WINDOWS=1 make publish-s3-binary-signed-release
WINDOWS=1 make choco-release
WINDOWS=1 make publish-s3-choco-release
ARCH=x86_64 STATIC=1 make publish-s3-binary AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_static
ARCH=aarch64 STATIC=1 make publish-s3-binary AWS_SHARED_CREDENTIALS_FILE=${WORKSPACE}/.aws_creds_static
rm ${WORKSPACE}/.aws_creds_static
'''
}
}
}
stage('Publish Installers') {
environment {
CHOCO_API_KEY = credentials('chocolatey-api-token')
}
when {
environment name: 'PUBLISH_INSTALLERS', value: 'true'
}
steps {
sh 'WINDOWS=1 make publish-choco-release'
}
}
}
}
}
post {
success {
script {
if (params.TASK_NAME == 'image-vulnerability-update') {
//TODO: change channel to #ibm-mezmo-agent after testing
notifySlack(
currentBuild.currentResult,
[channel: '#proj-agent'],
"`${PROJECT_NAME}` ${params.TASK_NAME} build took ${currentBuild.durationString.replaceFirst(' and counting', '')}."
)
}
}
}
unsuccessful {
script {
if (params.TASK_NAME == 'audit' || params.TASK_NAME == 'image-vulnerability-update') {
notifySlack(
currentBuild.currentResult,
[channel: '#proj-agent'],
"`${PROJECT_NAME}` ${params.TASK_NAME} build took ${currentBuild.durationString.replaceFirst(' and counting', '')}."
)
}
}
}
always {
sh 'ARCH=x86_64 make clean-all'
sh 'ARCH=aarch64 make clean-all'
cleanWs(deleteDirs: true,
// Uncomment the 'cleanWhenFailure: false,' line for debug
// cleanWhenFailure: false,
notFailBuild: true,
patterns: [[pattern: '.gitignore', type: 'INCLUDE'],
[pattern: '.propsfile', type: 'EXCLUDE']])
}
}
}