aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
blob: 7656232e6c8b0616c3ce549d9c74d4025784d24c (plain)
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
# content of service-account-credentials.json, used to access to Google Cloud Platform
gcp_credentials: ENCRYPTED[!e5f7207bd8d02d383733bef47e18296ac32e3b7d22eb480354e8dd8fdc0004be45a8a4e72c797bd66ee94eb3340fa363!]

env:
  GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:+PrintFlagsFinal -XshowSettings:vm -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF8 -Duser.language=en -Duser.country=US"
  # to be replaced by other credentials
  ARTIFACTORY_PRIVATE_USERNAME: repox-private-reader-sq-ef42e7
  ARTIFACTORY_PRIVATE_PASSWORD: ENCRYPTED[!bdffdd216a1b768605552475d16e8a5cedd97acbf8ca0aeb7256eaf98a2bc54f752c6c1be5391531742ebfee0cbd2ccf!]
  ARTIFACTORY_DEPLOY_USERNAME: repox-qa-deployer-sq-ef42e7
  ARTIFACTORY_DEPLOY_PASSWORD: ENCRYPTED[!d8838c939fe77f3b0a0510774c3b270832646e06cab8e477b35ff776933042105d211e7a0fb8ddcf826ce9f53258c519!]
  ARTIFACTORY_API_KEY: ENCRYPTED[!bdffdd216a1b768605552475d16e8a5cedd97acbf8ca0aeb7256eaf98a2bc54f752c6c1be5391531742ebfee0cbd2ccf!]
  ARTIFACTORY_PROMOTE_API_KEY: ENCRYPTED[!495d4e94f0847d36d1e54695c204500110da458c3be2c3f16c1e6c6fd8165bac6e8046e0d13c3869348990b34a149027!]
  # download licenses for testing commercial editions
  GITHUB_TOKEN: ENCRYPTED[!f458126aa9ed2ac526f220c5acb51dd9cc255726b34761a56fc78d4294c11089502a882888cef0ca7dd4085e72e611a5!]
  # notifications to burgr
  BURGR_URL: ENCRYPTED[24fba83587c1e9ed372b6cfdf12e4739ebe3b6e5b5082f1a2a742e840dd2e4b61fd5e281bf2632b22b3ad346c650c05c]
  BURGR_USERNAME: ENCRYPTED[cf7bfb936025fb763013bbfef0ab5723c0d9b53f135d79af36f9defa933f4b5fc72842bd83a97ce9b614503c1b77e6da]
  BURGR_PASSWORD: ENCRYPTED[bc554fc6a06c9f14cc9924cefad0a69e962a905b6d1609fc9357d458b45fc52ac74c960ad9c7382a0691433fa9dcd483]
  # analysis on next.sonarqube.com
  SONARQUBE_NEXT_TOKEN: ENCRYPTED[!0d599f9fb1613db33388821ca04af23f090729902b4421ad0a53cea8393d1e9039f2e47d65a246781b0e2c3718c172a1!]
  # to trigger docs deployment
  BUDDY_WORKS_TOKEN: ENCRYPTED[9ba648f3167b6f0c0befbba2f816bfffd53260fef06fb0fe8bba0a19ae4808c8b1567c5dcee2a2ee5299a5969058f495]
  ELASTIC_PWD: ENCRYPTED[78c127034b9f06bc1b5ad7a520de2da094f3eaf1dcb35f12b0f178fa90ce2fd157bd6f9feece9bf3a54b4e3805bc39fb]
  CIRRUS_LOG_TIMESTAMP: true
  # No need to clone the full history.
  # Depth of 1 is not enough because it would fail the build in case of consecutive pushes
  # (example of error: "Hard resetting to c968ecaf7a1942dacecd78480b3751ac74d53c33...Failed to force reset to c968ecaf7a1942dacecd78480b3751ac74d53c33: object not found!")
  CIRRUS_CLONE_DEPTH: 50
  BRANCH_MAIN: 'master'
  BRANCH_NIGHTLY: 'branch-nightly-build'
  BRANCH_PATTERN_MAINTENANCE: 'branch-.*'
  BRANCH_PATTERN_PUBLIC: 'public_.*'

auto_cancellation: $CIRRUS_BRANCH != $BRANCH_MAIN && $CIRRUS_BRANCH !=~ $BRANCH_PATTERN_MAINTENANCE

skip_public_branches_template: &SKIP_PUBLIC_BRANCHES_TEMPLATE
  skip: $CIRRUS_BRANCH =~ $BRANCH_PATTERN_PUBLIC

build_dependant_task_template: &BUILD_DEPENDANT_TASK_TEMPLATE
  depends_on: build

nightly_task_template: &NIGHTLY_TASK_TEMPLATE
  only_if: $CIRRUS_BRANCH == $BRANCH_NIGHTLY

except_nightly_task_template: &EXCEPT_ON_NIGHTLY_TASK_TEMPLATE
  only_if: $CIRRUS_BRANCH != $BRANCH_NIGHTLY

database_related_nightly_task_template: &DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  only_if: >-
    $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude('server/sonar-db-dao/**/*Mapper.xml', 'server/sonar-db-migration/**/DbVersion*.java', 'server/sonar-db-dao/**/*Dao.java')

saml_nightly_task_template: &SAML_NIGHTLY_TASK_TEMPLATE
  only_if: >-
    $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude('server/sonar-auth-saml/src/main/java/**/*.java', 'server/sonar-auth-saml/src/main/resources/**/*', 'server/sonar-db-dao/src/main/**/SAML*.java', 'private/it-core/src/test/java/org/sonarqube/tests/saml/*.java', 'server/sonar-webserver-webapi/src/main/java/org/sonar/server/saml/**/*.java')

docker_build_container_template: &GKE_CONTAINER_TEMPLATE
  dockerfile: private/docker/Dockerfile-build
  builder_image_project: sonarqube-team
  builder_image_name: family/docker-builder
  cluster_name: cirrus-ci-cluster
  zone: us-central1-a
  namespace: default
  cpu: 1
  memory: 2Gb

oracle_additional_container_template: &ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  name: oracle
  image: us.gcr.io/sonarqube-team/oracle12:0.0.1 # see https://github.com/SonarSource/vms/blob/master/docker/README.md#oracle-12c to build it
  port: 1521
  cpu: 2
  memory: 5Gb
  env:
    ORACLE_PWD: sonarqube

postgres_additional_container_template: &POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  name: postgres
  image: postgres:13.2
  port: 5432
  cpu: 1
  memory: 1Gb
  env:
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres

default_artifact_template: &DEFAULT_ARTIFACTS_TEMPLATE
  on_failure:
    jest_junit_cleanup_script: >
      find . -type f -wholename "**/build/test-results/test-jest/junit.xml" -exec
      xmlstarlet edit --inplace --delete '//testsuite[@errors=0 and @failures=0]' {} \;
    junit_artifacts:
      path: "**/build/test-results/**/*.xml"
      type: "text/xml"
      format: junit
    reports_artifacts:
      path: "**/build/reports/**/*"
    screenshots_artifacts:
      path: "**/build/screenshots/**/*"
  always:
    profile_artifacts:
      path: "**/build/reports/profile/**/*"

yarn_cache_template: &YARN_CACHE_TEMPLATE
  yarn_cache:
    folder: "~/.yarn/berry/cache"
    fingerprint_script: |
      cat \
        server/sonar-web/yarn.lock \
        server/sonar-docs/yarn.lock \
        private/core-extension-enterprise-server/yarn.lock \
        private/core-extension-license/yarn.lock \
        private/core-extension-securityreport/yarn.lock

gradle_cache_template: &GRADLE_CACHE_TEMPLATE
  gradle_cache:
    folder: "~/.gradle/caches"
    fingerprint_script: find -type f \( -name "*.gradle*" -or -name "gradle*.properties" \) -exec cat {} +

eslint_report_cache_template: &ESLINT_REPORT_CACHE_TEMPLATE
  eslint_report_cache:
    folders:
      - server/sonar-web/eslint-report/
      - private/core-extension-securityreport/eslint-report/
      - private/core-extension-license/eslint-report/
      - private/core-extension-enterprise-server/eslint-report/
      - private/core-extension-developer-server/eslint-report/
    fingerprint_script: echo $CIRRUS_BUILD_ID

jest_report_cache_template: &JEST_REPORT_CACHE_TEMPLATE
  jest_report_cache:
    folders:
      - server/sonar-web/coverage/
      - private/core-extension-securityreport/coverage/
      - private/core-extension-license/coverage/
      - private/core-extension-enterprise-server/coverage/
      - private/core-extension-developer-server/coverage/
    fingerprint_script: echo $CIRRUS_BUILD_ID

junit_report_cache_template: &JUNIT_REPORT_CACHE_TEMPLATE
  junit_report_cache:
    folders:
      - "**/reports/jacoco"
      - "**/test-results/test"
    fingerprint_script: echo $CIRRUS_BUILD_ID

build_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 8Gb
  env:
    ORG_GRADLE_PROJECT_signingKey: ENCRYPTED[!cc216dfe592f79db8006f2a591f8f98b40aa2b078e92025623594976fd32f6864c1e6b6ba74b50647f608e2418e6c336!]
    ORG_GRADLE_PROJECT_signingPassword: ENCRYPTED[!314a8fc344f45e462dd5e8dccd741d7562283a825e78ebca27d4ae9db8e65ce618e7f6aece386b2782a5abe5171467bd!]
    ORG_GRADLE_PROJECT_signingKeyId: 0x7DCD4258
  elasticsearch_distribution_cache:
    folder: sonar-application/build/elasticsearch-**.tar.gz
  script:
    - ./private/cirrus/cirrus-build.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_lint_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *ESLINT_REPORT_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 5
    memory: 6Gb
  script:
    - ./private/cirrus/cirrus-yarn-lint-report.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_check_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 5
    memory: 6Gb
  script: |
    ./private/cirrus/cirrus-env.sh YARN
    gradle yarn_check-ci --profile
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_validate_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *JEST_REPORT_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 20Gb
  script:
    - ./private/cirrus/cirrus-yarn-validate-ci.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

junit_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 20Gb
  script:
    - ./private/cirrus/cirrus-junit.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

validate_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *EXCEPT_ON_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *JEST_REPORT_CACHE_TEMPLATE
  <<: *ESLINT_REPORT_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  depends_on:
    - yarn_validate
    - yarn_lint
    - junit
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 28Gb
  env:
    # For the analysis, we need the full history.
    CIRRUS_CLONE_DEPTH: 0
  script:
    - ./private/cirrus/cirrus-validate.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 3
    memory: 7Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    matrix:
      - QA_CATEGORY: Cat1
      - QA_CATEGORY: Cat2
      - QA_CATEGORY: Cat3
      - QA_CATEGORY: Cat4
      - QA_CATEGORY: Cat5
      - QA_CATEGORY: Cat6
      - QA_CATEGORY: Cat7
      - QA_CATEGORY: Authentication
      - QA_CATEGORY: Enterprise
      - QA_CATEGORY: Dev
      - QA_CATEGORY: License
      - QA_CATEGORY: Branch
      - QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

task: #bitbucket
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 3
    memory: 10Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  maven_cache:
    folder: ~/.m2
  env:
    QA_CATEGORY: BITBUCKET
  matrix:
    - name: qa_bb_5.15.0
      bitbucket_background_script: ./private/cirrus/cirrus-start-bitbucket.sh 5.15.0
    - name: qa_bb_latest
      bitbucket_background_script: ./private/cirrus/cirrus-start-bitbucket.sh LATEST
  wait_for_bitbucket_to_boot_script: secs=3600; endTime=$(( $(date +%s) + secs )); while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:7990/bitbucket/status)" != "200" ]] || [ $(date +%s) -gt $endTime ]; do sleep 5; done
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_bb_cloud_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 5Gb
  env:
    QA_CATEGORY: BITBUCKET_CLOUD
    BBC_CLIENT_ID: ENCRYPTED[f1c2c57d5f02885345b3db5776a3b28f5dbcc89723809f73ad05ada903ece9584f1dfe61b026c10eabd72c75d1258bac]
    BBC_CLIENT_SECRET: ENCRYPTED[39cc89ce4695c243fd688e687879bd473a60882fd30ba8613d6697e5d2b04e2017c68cae3a9a7ed9704f69c52bf229ee]
    BBC_READ_REPOS_APP_PASSWORD: ENCRYPTED[35e0b64a4abbff0a061d58d0ad892bbaf5a6912784ac18167df788ee5c8188e98b98dd1b76e31fba090092b8b36d5317]
    BBC_USERNAME: ENCRYPTED[75707b0448dabae3f028533a412df424da16bf9fe239474a6678f4f0af9ec9cd9571f6d37fa44dadfd99a76c5584b70c]
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_ha_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    QA_CATEGORY: HA
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

docker_gitlab_container_build_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  gce_instance:
    image_project: sonarqube-team
    image_family: docker-builder
    zone: us-central1-a
    preemptible: true
    disk: 10
    cpu: 4
    memory: 8G
  env:
    matrix:
      - GITLAB_TAG: latest
      - GITLAB_TAG: 11.7.0-ce.0
  build_script:
    - docker pull "us.gcr.io/sonarqube-team/sq-gitlab:${GITLAB_TAG}" || true
    - docker build --build-arg "GITLAB_TAG=${GITLAB_TAG}" --cache-from "us.gcr.io/sonarqube-team/sq-gitlab:${GITLAB_TAG}" -t "us.gcr.io/sonarqube-team/sq-gitlab:${GITLAB_TAG}" private/docker/gitlab/
    - docker push "us.gcr.io/sonarqube-team/sq-gitlab:${GITLAB_TAG}"

# GitLab QA is executed in a dedicated task in order to not slow down the pipeline, as a GitLab on-prem server docker image is required.
qa_gitlab_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  depends_on:
    - build
    - docker_gitlab_container_build
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 5Gb
    use_in_memory_disk: true
    additional_containers:
      - name: gitlab
        ports:
          - 80
          - 443
        cpu: 2
        memory: 5Gb
        matrix:
          - image: us.gcr.io/sonarqube-team/sq-gitlab:latest
          - image: us.gcr.io/sonarqube-team/sq-gitlab:11.7.0-ce.0
  env:
    QA_CATEGORY: GITLAB
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_gitlab_cloud_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 5Gb
    use_in_memory_disk: true
  env:
    QA_CATEGORY: GITLAB_CLOUD
    GITLAB_API_TOKEN: ENCRYPTED[a64a349d6185822adb17480cf507583fea6ba13b53edd4be6fb0eae76cf573bf7e68d560b7e57e1cc304cc719845c223]
    GITLAB_READ_ONLY_TOKEN: ENCRYPTED[29eb9c8643123f871329f0a88b540af401eb7f3f6f70447e0c80a955002f7998867faf2007bbb1b11880473f69384af9]
    GITLAB_ADMIN_USERNAME: ENCRYPTED[9bce572f769cb5432a691418879d7ab9bd74727bb9c16abe31af1b1beffabdce1720b9d8c888c37a3ce589473b44d5be]
    GITLAB_ADMIN_PASSWORD: ENCRYPTED[78e94b179d425e87d8f8b9ccaa1d117d8ffaec71eaee8ca7a3e36d1a885b85a61695f55031ab786af04d2181e3eadeb2]
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

# Azure QA is executed in a dedicated task in order to not slow down the pipeline.
qa_azure_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 5Gb
  env:
    QA_CATEGORY: AZURE
    AZURE_USERNAME_LOGIN: ENCRYPTED[dcdf19769c1501408ebc22670c76d5e375cd739de2df5dfa3f215aa795296dfb257dbbcbe9bdfd33135feb04421fea1f]
    AZURE_CODE_READ_AND_WRITE_TOKEN: ENCRYPTED[eddc3448b40e72310f24f21241bdc1243860139d1a5aad593b016baedf03e4bba3f9e3d8d9f6329fe3b587966a8112d2]
    AZURE_FULL_ACCESS_TOKEN: ENCRYPTED[58779d6588e2e10d1b6f98fcc58a46957f8ef3a18e29d79abc6aa8d69ea55c23d8708e1f1af626464d309b1c7c087985]
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_github_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 5Gb
  env:
    QA_CATEGORY: GITHUB
    GITHUB_COM_CODE_SCANNING_ALERTS_TECHNICAL_USER_USERNAME: ENCRYPTED[ac65bdcd84c5e5ff164bfffdea5f77b886a8be7f8586a9a9a41f5a648d9fcb33cc2fd5cd7aa6fcda3aa7f0372ccb007b]
    GITHUB_COM_CODE_SCANNING_ALERTS_TECHNICAL_USER_TOKEN: ENCRYPTED[ac3877b534eb925c2c7989074a283a6eac83f1e54858e9ff5b97764a78857028dc21added63100cc730b0bb2b8ec4727]
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

# SAML QA is executed in a dedicated task in order to not slow down the pipeline, as a Keycloak server docker image is required.
qa_saml_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *SAML_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
    additional_containers:
      - name: keycloak
        image: quay.io/keycloak/keycloak:17.0.1
        port: 8080
        cpu: 1
        memory: 1Gb
        command: "/opt/keycloak/bin/kc.sh start-dev --http-relative-path /auth"
        env:
          KEYCLOAK_ADMIN: admin
          KEYCLOAK_ADMIN_PASSWORD: admin
  env:
    QA_CATEGORY: SAML
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

# LDAP QA is executed in a dedicated task in order to not slow down the pipeline, as a LDAP server and SonarQube server are re-started on each test.
qa_ldap_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
  env:
    QA_CATEGORY: LDAP
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

promote_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *EXCEPT_ON_NIGHTLY_TASK_TEMPLATE
  depends_on:
    - build
    - validate
    - qa
    - qa_saml
    - qa_ldap
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
  stateful: true
  script:
    - ./private/cirrus/cirrus-promote.sh

package_docker_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  depends_on: promote
  only_if: $CIRRUS_BRANCH == $BRANCH_MAIN
  gce_instance:
    image_project: sonarqube-team
    image_family: docker-builder
    zone: us-central1-a
    disk: 10
    cpu: 4
    memory: 8G
  clone_script: |
    git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR --depth=1
    git fetch origin $CIRRUS_CHANGE_IN_REPO --depth=1
    git reset --hard $CIRRUS_CHANGE_IN_REPO
  install_tooling_script:
    - ./private/cirrus/cirrus-tooling-for-package-docker.sh
  package_script:
    - ./private/cirrus/cirrus-package-docker.sh

sql_mssql_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - name: mssql
        image: mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04
        port: 1433
        cpu: 2
        memory: 5Gb
        env:
          MSSQL_PID: Developer # this is the default edition
          ACCEPT_EULA: Y
          SA_PASSWORD: sonarqube!1
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh mssql
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

sql_postgres_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

# this is the oldest compatible version of PostgreSQL
sql_postgres96_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
        image: postgres:9.6
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

sql_oracle12_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - <<: *ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh oracle12
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

upgd_mssql_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 1.5
    memory: 6Gb
    additional_containers:
      - name: mssql
        image: mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04
        port: 1433
        cpu: 2
        memory: 5Gb
        env:
          MSSQL_PID: Developer # this is the default edition
          ACCEPT_EULA: Y
          SA_PASSWORD: sonarqube!1
  env:
    QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh mssql
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

upgd_oracle12_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *DATABASE_RELATED_NIGHTLY_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 1.5
    memory: 6Gb
    additional_containers:
      - <<: *ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh oracle12
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

ws_scan_task:
  <<: *SKIP_PUBLIC_BRANCHES_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: >-
    $CIRRUS_BRANCH == $BRANCH_MAIN ||
    ($CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE && $CIRRUS_BRANCH != $BRANCH_NIGHTLY)
  <<: *YARN_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  timeout_in: 30m
  gke_container:
    <<: *GKE_CONTAINER_TEMPLATE
    cpu: 2
    memory: 4Gb
  env:
    WS_APIKEY: ENCRYPTED[308f809a4051b3225bed52131b32fb52895bc5a12c23e901f35b1d1e9d80bcaf75a1023c0dd171994bdbe790b4055e66]
    WS_WSS_URL: "https://saas-eu.whitesourcesoftware.com/agent"
    WS_USERKEY: ENCRYPTED[747f9c9006cf9859fd5f02bad85a044c5c0f32d12190deb624d480ad6d86b2f114da136e068645281e9e83e2f0727ab2]
    SLACK_WEBHOOK_SQ: ENCRYPTED[dec8e4350cbea3b94d63098558bcb3ae9e79b71c2b6286fcfb9eb80c0953b6448b10f7271b07b5e75e52f362c25d7a8f]
  whitesource_script:
    - ./private/cirrus/cirrus-whitesource-scan.sh
  allow_failures: "true"
  on_failure:
    slack_notification_script:
      - ./private/cirrus/cirrus-whitesource-notifications.sh
  always:
    ws_artifacts:
      path: "whitesource/**/*"