forked from cyberark/conjur
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
858 lines (782 loc) · 27.2 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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
#!/usr/bin/env groovy
/*
NOTE TO DEVELOPERS:
When developing, you'll often need to use the CI to test to verify work, but
only care about the result of a single test, or a few tests. In this case, you
can dramatically cut down your cycle time (to about 10 minutes) by running only
the relevant tests.
There are two ways to do this:
1. (most common) Temporarily edit the Jenkinsfile. You'll need to undo your
change when your PR is ready for review. Simply edit the default value of
the 'RUN_ONLY' parameter (defined in the parameters block below) to a
space-separated list consisting of test names from the list below.
2. Re-run the same code (perhaps because of a flaky test) directly in Jenkins.
In this case, go to your branch in Jenkins (not Blue Ocean). For example:
https://jenkins.conjur.net/job/cyberark--conjur/job/<MY-NICE_BRANCH>
And click on "Build with Parameters" in the left nav. In the RUN_ONLY text
input, enter a list of space-separated test names that you want to run, from
the list below:
LIST OF ALL TEST NAMES
These are defined in runConjurTests, and also include the one-offs
"azure_authenticator" and "gcp_authenticator":
rspec
authenticators_config
authenticators_status
authenticators_ldap
authenticators_oidc
authenticators_jwt
policy
api
rotators
authenticators_k8s
rspec_audit
policy_parser
azure_authenticator
gcp_authenticator
*/
// Automated release, promotion and dependencies
properties([
// Include the automated release parameters for the build
release.addParams(),
// Dependencies of the project that should trigger builds
dependencies(['cyberark/conjur-base-image',
'cyberark/conjur-api-ruby',
'conjurinc/debify'])
])
// Performs release promotion. No other stages will be run
if (params.MODE == "PROMOTE") {
release.promote(params.VERSION_TO_PROMOTE) { sourceVersion, targetVersion, assetDirectory ->
sh "docker pull registry.tld/cyberark/conjur:${sourceVersion}"
sh "docker tag registry.tld/cyberark/conjur:${sourceVersion} conjur:${sourceVersion}"
sh "docker pull registry.tld/conjur-ubi:${sourceVersion}"
sh "docker tag registry.tld/conjur-ubi:${sourceVersion} conjur-ubi:${sourceVersion}"
sh "summon -f ./secrets.yml ./publish-images.sh --promote --redhat --base-version=${sourceVersion} --version=${targetVersion}"
// Trigger Conjurops build to push newly promoted releases of conjur to ConjurOps Staging
build(
job:'../conjurinc--conjurops/master',
parameters:[
string(name: 'conjur_oss_source_image', value: "cyberark/conjur:${targetVersion}")
],
wait: false
)
}
return
}
pipeline {
agent { label 'executor-v2' }
options {
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30'))
timeout(time: 2, unit: 'HOURS')
}
// "parameterizedCron" is defined by this native Jenkins plugin:
// https://plugins.jenkins.io/parameterized-scheduler/
// "getDailyCronString" is defined by us (URL is wrapped):
// https://github.com/conjurinc/jenkins-pipeline-library/blob/master/vars/
// getDailyCronString.groovy
triggers {
parameterizedCron(getDailyCronString("%NIGHTLY=true"))
}
parameters {
booleanParam(
name: 'NIGHTLY',
defaultValue: false,
description: 'Run tests on all agents and environment including: FIPS'
)
string(
name: 'RUN_ONLY',
description:
'Run only one (or a few) test for development. Space-separated list, ' +
'empty to run all tests. See Jenkinsfile for details.',
// See note at top of file for temporarily changing this value during
// development.
defaultValue: ''
)
string(
name: 'CUCUMBER_FILTER_TAGS',
description: 'Filter which cucumber tags will run (e.g. "not @performance")',
defaultValue: defaultCucumberFilterTags(env)
)
}
environment {
// Sets the MODE to the specified or autocalculated value as appropriate
MODE = release.canonicalizeMode()
}
stages {
// Aborts any builds triggered by another project that wouldn't include any changes
stage ("Skip build if triggering job didn't create a release") {
when {
expression {
MODE == "SKIP"
}
}
steps {
script {
currentBuild.result = 'ABORTED'
error("Aborting build because this build was triggered from upstream, but no release was built")
}
}
}
// Generates a VERSION file based on the current build number and latest version in CHANGELOG.md
stage('Validate Changelog and set version') {
steps {
updateVersion("CHANGELOG.md", "${BUILD_NUMBER}")
stash name: 'version_info', includes: 'VERSION'
}
}
stage('Fetch tags') {
steps {
withCredentials(
[
usernameColonPassword(
credentialsId: 'conjur-jenkins-api', variable: 'GITCREDS'
)
]
) {
sh '''
git fetch --tags "$(
git remote get-url origin |
sed -e "s|https://|https://$GITCREDS@|"
)"
# print them out to make sure, can remove when this is robust
git tag
'''
}
}
}
stage('Validate Changelog') {
when {
expression { params.RUN_ONLY == '' }
}
steps {
sh 'ci/parse-changelog'
}
}
stage('Build and test Conjur') {
when {
// Run tests only when ANY of the following is true:
// 1. A non-markdown file has changed.
// 2. It's running on the master branch (which includes nightly builds).
// 3. It's a tag-triggered build.
anyOf {
// Note: You cannot use "when"'s changeset condition here because it's
// not powerful enough to express "_only_ md files have changed".
// Dropping down to a git script was the easiest alternative.
expression {
0 == sh(
returnStatus: true,
// A non-markdown file has changed.
script: '''
git diff origin/master --name-only |
grep -v "^.*\\.md$" > /dev/null
'''
)
}
// Always run the full pipeline on the master branch (which includes
// nightly builds)
branch "master"
// Always run the full pipeline on tags of the form v*
tag "v*"
}
}
stages {
stage('Build Docker Image') {
steps {
sh './build.sh --jenkins'
}
}
stage('Push images to internal registry') {
steps {
// Push images to the internal registry so that they can be used
// by tests, even if the tests run on a different executor.
sh './publish-images.sh --internal'
}
}
stage('Scan Docker Image') {
when {
expression { params.RUN_ONLY == '' }
}
parallel {
stage("Scan Docker Image for fixable issues") {
steps {
scanAndReport("conjur:${tagWithSHA()}", "HIGH", false)
}
}
stage("Scan Docker image for total issues") {
steps {
scanAndReport("conjur:${tagWithSHA()}", "NONE", true)
}
}
stage("Scan UBI-based Docker Image for fixable issues") {
steps {
scanAndReport("conjur-ubi:${tagWithSHA()}", "HIGH", false)
}
}
stage("Scan UBI-based Docker image for total issues") {
steps {
scanAndReport("conjur-ubi:${tagWithSHA()}", "NONE", true)
}
}
}
}
// TODO: Add comments explaining which env vars are set here.
stage('Prepare For CodeClimate Coverage Report Submission') {
when {
expression { params.RUN_ONLY == '' }
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script {
ccCoverage.dockerPrep()
sh 'mkdir -p coverage'
env.CODE_CLIMATE_PREPARED = "true"
}
}
}
}
// Run outside parallel block to avoid external pressure
stage('RSpec - Standard agent tests') {
steps {
sh 'ci/test rspec'
}
}
// Run outside parallel block to reduce main Jenkins executor load.
stage('Nightly Only') {
when {
expression { params.NIGHTLY }
}
environment {
CUCUMBER_FILTER_TAGS = "${params.CUCUMBER_FILTER_TAGS}"
}
stages {
stage('EE FIPS agent tests') {
agent { label 'executor-v2-rhel-ee' }
steps {
unstash 'version_info'
// Catch errors so remaining steps always run.
catchError {
// Run outside parallel block to avoid external pressure
script {
stage("RSpec - EE FIPS agent tests") {
sh "ci/test rspec"
}
}
runConjurTests(params.RUN_ONLY)
}
stash(
name: 'testResultEE',
includes: '''
cucumber/*/*.*,
container_logs/*/*,
spec/reports/*.xml,
spec/reports-audit/*.xml,
cucumber/*/features/reports/**/*.xml
'''
)
}
post {
always {
dir('ee-test'){
unstash 'testResultEE'
}
archiveArtifacts(
artifacts: "ee-test/cucumber/*/*.*",
fingerprint: false,
allowEmptyArchive: true
)
archiveArtifacts(
artifacts: "ee-test/container_logs/*/*",
fingerprint: false,
allowEmptyArchive: true
)
publishHTML(
reportDir: 'ee-test/cucumber',
reportFiles: '''
api/cucumber_results.html,
authenticators_config/cucumber_results.html,
authenticators_azure/cucumber_results.html,
authenticators_ldap/cucumber_results.html,
authenticators_oidc/cucumber_results.html,
authenticators_jwt/cucumber_results.html,
authenticators_status/cucumber_results.html
policy/cucumber_results.html,
rotators/cucumber_results.html
''',
reportName: 'EE Integration reports',
reportTitles: '',
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true
)
}
}
}
}
}
stage('Run environment tests in parallel') {
parallel {
stage('Standard agent tests') {
environment {
CUCUMBER_FILTER_TAGS = "${params.CUCUMBER_FILTER_TAGS}"
}
steps {
runConjurTests(params.RUN_ONLY)
}
}
stage('Azure Authenticator') {
when {
expression {
testShouldRun(params.RUN_ONLY, "azure_authenticator")
}
}
agent { label 'azure-linux' }
environment {
// TODO: Move this into the authenticators_azure bash script.
AZURE_AUTHN_INSTANCE_IP = sh(
script: 'curl "http://checkip.amazonaws.com"',
returnStdout: true
).trim()
// TODO: Move this into the authenticators_azure bash script.
SYSTEM_ASSIGNED_IDENTITY = sh(
script: 'ci/test_suites/authenticators_azure/' +
'get_system_assigned_identity.sh',
returnStdout: true
).trim()
}
steps {
unstash 'version_info'
// Grant access to this Jenkins agent's IP to AWS security groups
// This is required for access to the internal docker registry
// from outside EC2.
grantIPAccess()
sh(
'summon -f ci/test_suites/authenticators_azure/secrets.yml ' +
'ci/test authenticators_azure'
)
}
post {
always {
stash(
name: 'testResultAzure',
allowEmpty: true,
includes: '''
cucumber/*azure*/*.*,
container_logs/*azure*/*,
cucumber_results*.json
'''
)
// Remove this Agent's IP from IPManager's prefix list
// There are a limited number of entries, so it remove it
// rather than waiting for it to expire.
removeIPAccess()
}
}
}
/**
* GCP Authenticator -- Token Stashing -- Stage 1 of 3
*
* In this stage, a GCE instance node is allocated, a script runs
* and retrieves all the tokens that will be used in authn-gcp
* tests. The token are stashed, and later un-stashed and used in
* the stage that runs the GCP Authenticator tests. This way we can
* have a light-weight GCE instance that has no dependency on
* conjurops or git identities and is not open for SSH.
*/
stage('GCP Authenticator preparation - Allocate GCE Instance') {
when {
expression {
testShouldRun(params.RUN_ONLY, "gcp_authenticator")
}
}
steps {
echo '-- Allocating Google Compute Engine'
script {
dir('ci/test_suites/authenticators_gcp') {
stash(
name: 'get_gce_tokens_script',
includes: '''
get_gce_tokens_to_files.sh,
get_tokens_to_files.sh,
tokens_config.json
'''
)
}
node('executor-v2-gcp-small') {
echo '-- Google Compute Engine allocated'
echo '-- Get compute engine instance project name from ' +
'Google metadata server.'
// TODO: Move this into get_gce_tokens_to_files.sh
env.GCP_PROJECT = sh(
script: 'curl -s -H "Metadata-Flavor: Google" ' +
'"http://metadata.google.internal/computeMetadata/v1/' +
'project/project-id"',
returnStdout: true
).trim()
unstash('get_gce_tokens_script')
sh('./get_gce_tokens_to_files.sh')
stash(
name: 'authnGceTokens',
includes: 'gce_token_*',
allowEmpty:false
)
}
}
}
post {
failure {
script {
env.GCP_ENV_ERROR = "true"
}
}
success {
script {
env.GCE_TOKENS_FETCHED = "true"
}
echo '-- Finished fetching GCE tokens.'
}
}
}
/**
* GCP Authenticator -- Allocate Function -- Stage 2 of 3
*
* In this stage, Google SDK container executes a script to deploy a
* function, the function accepts audience in query string and
* returns a token with that audience. All the tokens required for
* testings are obtained and written to function directory, the post
* stage branch deletes the function. This stage depends on stage:
* 'GCP Authenticator preparation - Allocate GCE Instance' to set
* the GCP project env var.
*/
stage('GCP Authenticator preparation - Allocate Google Function') {
when {
expression {
testShouldRun(params.RUN_ONLY, "gcp_authenticator")
}
}
environment {
GCP_FETCH_TOKEN_FUNCTION = "fetch_token_${BUILD_NUMBER}"
IDENTITY_TOKEN_FILE = 'identity-token'
GCP_OWNER_SERVICE_KEY_FILE = "sa-key-file.json"
}
steps {
echo "Waiting for GCP project name (Set by stage: " +
"'GCP Authenticator preparation - Allocate GCE Instance')"
timeout(time: 10, unit: 'MINUTES') {
waitUntil {
script {
return (
env.GCP_PROJECT != null || env.GCP_ENV_ERROR == "true"
)
}
}
}
script {
if (env.GCP_ENV_ERROR == "true") {
error('GCP_ENV_ERROR cannot deploy function')
}
dir('ci/test_suites/authenticators_gcp') {
sh('summon ./deploy_function_and_get_tokens.sh')
}
}
}
post {
success {
echo "-- Google Cloud test env is ready"
script {
env.GCP_FUNC_TOKENS_FETCHED = "true"
}
}
failure {
echo "-- GCP function deployment stage failed"
script {
env.GCP_ENV_ERROR = "true"
}
}
always {
script {
dir('ci/test_suites/authenticators_gcp') {
sh '''
# Cleanup Google function
summon ./run_gcloud.sh cleanup_function.sh
'''
}
}
}
}
}
/**
* GCP Authenticator -- Run Tests -- Stage 3 of 3
*
* We have two preparation stages before running the GCP
* Authenticator tests stage. This stage waits for GCP preparation
* stages to complete, un-stashes the tokens created in stage: 'GCP
* Authenticator preparation - Allocate GCE Instance' and runs the
* gcp-authn tests.
*/
stage('GCP Authenticator - Run Tests') {
when {
expression {
testShouldRun(params.RUN_ONLY, "gcp_authenticator")
}
}
steps {
echo('Waiting for GCP Tokens provisioned by prep stages.')
timeout(time: 10, unit: 'MINUTES') {
waitUntil {
script {
return (
env.GCP_ENV_ERROR == "true" ||
(
env.GCP_FUNC_TOKENS_FETCHED == "true" &&
env.GCE_TOKENS_FETCHED == "true"
)
)
}
}
}
script {
if (env.GCP_ENV_ERROR == "true") {
error(
'GCP_ENV_ERROR: Check logs for errors in stages 1 and 2'
)
}
}
script {
dir('ci/test_suites/authenticators_gcp/tokens') {
unstash 'authnGceTokens'
}
sh 'ci/test authenticators_gcp'
}
}
}
}
}
}
post {
success {
script {
if (env.BRANCH_NAME == 'master') {
build(
job:'../cyberark--secrets-provider-for-k8s/main',
wait: false
)
}
}
}
always {
script {
// Only unstash azure if it ran.
if (testShouldRun(params.RUN_ONLY, "azure_authenticator")) {
unstash 'testResultAzure'
}
// Make files available for download.
archiveFiles('container_logs/*/*')
archiveFiles('coverage/.resultset*.json')
archiveFiles('coverage/coverage.json')
archiveFiles('coverage/codeclimate.json')
archiveFiles(
'ci/test_suites/authenticators_k8s/output/simplecov-resultset-authnk8s-gke.json'
)
archiveFiles('cucumber/*/*.*')
publishHTML([
reportName: 'Integration reports',
reportDir: 'cucumber',
reportFiles: '''
api/cucumber_results.html,
authenticators_config/cucumber_results.html,
authenticators_azure/cucumber_results.html,
authenticators_ldap/cucumber_results.html,
authenticators_oidc/cucumber_results.html,
authenticators_jwt/cucumber_results.html,
authenticators_gcp/cucumber_results.html,
authenticators_status/cucumber_results.html,
authenticators_k8s/cucumber_results.html,
policy/cucumber_results.html,
rotators/cucumber_results.html
''',
reportTitles: '',
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true
])
publishHTML(
reportName: 'Coverage Report',
reportDir: 'coverage',
reportFiles: 'index.html',
reportTitles: '',
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true
)
junit('''
spec/reports/*.xml,
spec/reports-audit/*.xml,
cucumber/*/features/reports/**/*.xml,
ee-test/spec/reports/*.xml,
ee-test/spec/reports-audit/*.xml,
ee-test/cucumber/*/features/reports/**/*.xml
'''
)
// Make cucumber reports available as html report in Jenkins UI.
cucumber(
fileIncludePattern: '**/cucumber_results.json',
sortingMethod: 'ALPHABETICAL'
)
}
}
}
} // end stage: build and test conjur
stage('Submit Coverage Report') {
when {
expression {
env.CODE_CLIMATE_PREPARED == "true"
}
}
steps{
sh 'ci/submit-coverage'
}
}
stage("Release Conjur images and packages") {
when {
expression {
MODE == "RELEASE"
}
}
steps {
release { billOfMaterialsDirectory, assetDirectory ->
// Publish docker images
sh './publish-images.sh --edge --dockerhub'
// Create deb and rpm packages
sh 'echo "CONJUR_VERSION=5" >> debify.env'
sh './package.sh'
archiveArtifacts artifacts: '*.deb', fingerprint: true
archiveArtifacts artifacts: '*.rpm', fingerprint: true
sh "cp *.rpm ${assetDirectory}/."
sh "cp *.deb ${assetDirectory}/."
// Publish deb and rpm packages
sh './publish.sh'
}
}
}
}
post {
always {
// Explanation of arguments:
// cleanupAndNotify(buildStatus, slackChannel, additionalMessage, ticket)
cleanupAndNotify(
currentBuild.currentResult,
'#conjur-core',
"${(params.NIGHTLY ? 'nightly' : '')}",
true
)
}
}
}
////////////////////////////////////////////
// Functions
////////////////////////////////////////////
// TODO: Do we want to move any of these functions to a separate file?
// Possible minor optimization: Could memoize this. Need to verify it's not
// shared across builds.
def tagWithSHA() {
sh(
returnStdout: true,
script: 'echo $(git rev-parse --short=8 HEAD)'
)
}
def archiveFiles(filePattern) {
archiveArtifacts(
artifacts: filePattern,
fingerprint: false,
allowEmptyArchive: true
)
}
def testShouldRun(run_only_str, test) {
return run_only_str == '' || run_only_str.split().contains(test)
}
// "run_only_str" is a space-separated string specifying the subset of tests to
// run. If it's empty, all tests are run.
def runConjurTests(run_only_str) {
all_tests = [
"authenticators_config": [
"Authenticators Config - ${env.STAGE_NAME}": {
sh 'ci/test authenticators_config'
}
],
"authenticators_status": [
"Authenticators Status - ${env.STAGE_NAME}": {
sh 'ci/test authenticators_status'
}
],
"authenticators_k8s": [
"K8s Authenticator - ${env.STAGE_NAME}": {
sh 'ci/test authenticators_k8s'
}
],
"authenticators_ldap": [
"LDAP Authenticator - ${env.STAGE_NAME}": {
sh 'ci/test authenticators_ldap'
}
],
"authenticators_oidc": [
"OIDC Authenticator - ${env.STAGE_NAME}": {
sh 'summon -f ./ci/test_suites/authenticators_oidc/secrets.yml -e ci ci/test authenticators_oidc'
}
],
"authenticators_jwt": [
"JWT Authenticator - ${env.STAGE_NAME}": {
sh 'ci/test authenticators_jwt'
}
],
"policy": [
"Policy - ${env.STAGE_NAME}": {
sh 'ci/test policy'
}
],
"api": [
"API - ${env.STAGE_NAME}": {
sh 'ci/test api'
}
],
"rotators": [
"Rotators - ${env.STAGE_NAME}": {
sh 'ci/test rotators'
}
],
"rspec_audit": [
"Audit - ${env.STAGE_NAME}": {
sh 'ci/test rspec_audit'
}
],
"policy_parser": [
"Policy Parser - ${env.STAGE_NAME}": {
sh 'cd gems/policy-parser && ./test.sh'
}
]
]
// Filter for the tests we want run, if requested.
parallel_tests = all_tests
tests = run_only_str.split()
if (tests.size() > 0) {
parallel_tests = all_tests.subMap(tests)
}
// Create the parallel pipeline.
//
// Since + merges two maps together, sum() combines the individual values of
// parallel_tests into one giant map whose keys are the stage names and
// whose values are the blocks to be run.
script {
parallel(
parallel_tests.values().sum()
)
}
}
def defaultCucumberFilterTags(env) {
if(env.BRANCH_NAME == 'master' || env.TAG_NAME?.trim()) {
// If this is a master or tag build, we want to run all of the tests. So
// we use an empty filter string.
return ''
}
// For all other branch builds, only run the @smoke tests by default
return '@smoke'
}