aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
blob: a9477a8cc7a922887760f985e1992e0a72394fda (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
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
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
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: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader
  ARTIFACTORY_PRIVATE_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
  ARTIFACTORY_DEPLOY_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer
  ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
  ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
  ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
  ARTIFACTORY_URL: "https://repox.jfrog.io/repox"
  ARTIFACTORY_DEPLOY_REPO: "sonarsource-public-qa"
  ARTIFACTORY_DEPLOY_REPO_PRIVATE: "sonarsource-private-qa"
  # download licenses for testing commercial editions
  GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token]
  # notifications to burgr
  BURGR_URL: VAULT[development/kv/data/burgr data.url]
  BURGR_USERNAME: VAULT[development/kv/data/burgr data.cirrus_username]
  BURGR_PASSWORD: VAULT[development/kv/data/burgr data.cirrus_password]
  # analysis on next.sonarqube.com
  SONARQUBE_NEXT_TOKEN: VAULT[development/kv/data/next data.token]
  # to trigger docs deployment
  ELASTIC_PWD: VAULT[development/team/sonarqube/kv/data/elasticsearch-cloud data.password]
  DATADOG_APIKEY: VAULT[development/team/sonarqube/kv/data/sq-datadog data.apikey]
  CIRRUS_LOG_TIMESTAMP: true
  BRANCH_MAIN: "master"
  BRANCH_NIGHTLY: "branch-nightly-build"
  BRANCH_PATTERN_MAINTENANCE: "branch-.*"
  BRANCH_PATTERN_PUBLIC: "public_.*"
  CRON_DATABASE_JOB_NAME: "master-weekly"
  GRADLE_ENTERPRISE_USERNAME: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.username]
  GRADLE_ENTERPRISE_PASSWORD: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.password]
  GRADLE_ENTERPRISE_URL: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.url]
  GRADLE_ENTERPRISE_KEY: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.access-key]

bitbucket_cloud_environment_template: &BITBUCKET_CLOUD_ENVIRONMENT_VARIABLES
  BBC_CLIENT_ID: VAULT[development/team/sonarqube/kv/data/bitbucket-cloud data.client_id]
  BBC_CLIENT_SECRET: VAULT[development/team/sonarqube/kv/data/bitbucket-cloud data.client_secret]
  BBC_USERNAME: VAULT[development/kv/data/bitbucket/sonarqube-its data.username]
  BBC_READ_REPOS_APP_PASSWORD: VAULT[development/kv/data/bitbucket/sonarqube-its data.password]

gitlab_cloud_environment_template: &GITLAB_CLOUD_ENVIRONMENT_VARIABLES
  GITLAB_API_TOKEN: VAULT[development/team/sonarqube/kv/data/gitlab-cloud data.api_token]
  GITLAB_READ_ONLY_TOKEN: VAULT[development/team/sonarqube/kv/data/gitlab-cloud data.api_token_ro]
  GITLAB_ADMIN_USERNAME: VAULT[development/team/sonarqube/kv/data/gitlab-cloud data.username]
  GITLAB_ADMIN_PASSWORD: VAULT[development/team/sonarqube/kv/data/gitlab-cloud data.password]

azure_cloud_environment_template: &AZURE_CLOUD_ENVIRONMENT_VARIABLES
  AZURE_USERNAME_LOGIN: VAULT[development/team/sonarqube/kv/data/azure-instance data.username]
  AZURE_CODE_READ_AND_WRITE_TOKEN: VAULT[development/team/sonarqube/kv/data/azure-instance data.token_code_read_write]
  AZURE_FULL_ACCESS_TOKEN: VAULT[development/team/sonarqube/kv/data/azure-instance data.token_full_access]

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

cache_dependencies_dependant_task_template:
  &CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  depends_on: cache_dependencies

build_dependant_task_template: &BUILD_DEPENDANT_TASK_TEMPLATE
  depends_on: build

master_task_template: &IS_BRANCH_MASTER
  $CIRRUS_BRANCH == $BRANCH_MAIN

master_and_nightly_task_template: &IS_BRANCH_MASTER_OR_NIGHTLY
  $CIRRUS_BRANCH == $BRANCH_NIGHTLY || $CIRRUS_BRANCH == $BRANCH_MAIN

master_or_nightly_or_maintenance_task_template: &IS_BRANCH_MASTER_OR_NIGHTLY_OR_MAINTENANCE
  $CIRRUS_BRANCH == $BRANCH_NIGHTLY || $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE

is_weekly_job: &IS_WEEKLY_JOB
  $CIRRUS_CRON == $CRON_DATABASE_JOB_NAME

is_old_commit: &IS_OLD_COMMIT
  $CIRRUS_CRON == $CRON_DATABASE_JOB_NAME || $CIRRUS_BRANCH == $BRANCH_NIGHTLY

is_branch_public: &IS_BRANCH_PUBLIC
  $CIRRUS_BRANCH =~ $BRANCH_PATTERN_PUBLIC

is_old_commit_or_public_branch: &IS_OLD_COMMIT_OR_BRANCH_PUBLIC
  $CIRRUS_CRON == $CRON_DATABASE_JOB_NAME || $CIRRUS_BRANCH == $BRANCH_NIGHTLY || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_PUBLIC

database_related_task_template: &IS_DB_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude('server/sonar-db-dao/**/*Mapper.xml', 'server/sonar-db-migration/**/DbVersion*.java', 'server/sonar-db-dao/**/*Dao.java', 'server/sonar-db-core/src/main/java/org/sonar/db/*.java')

saml_task_template: &IS_SAML_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $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')

ldap_task_template: &IS_LDAP_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude('server/sonar-auth-ldap/src/main/java/**/*.java', 'server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/LdapCredentialsAuthentication.java', 'private/it-core/src/test/java/org/sonarqube/tests/ldap/*.java')

github_task_template: &IS_GITHUB_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude(
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/github/**/*.java',
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/github/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/github/**/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/github/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/provisioning/github/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/onboarding/github/*.java',
    'private/core-extension-github-provisioning/**/*')

gitlab_task_template: &IS_GITLAB_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude(
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/gitlab/**/*.java',
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/gitlab/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/gitlab/**/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/gitlab/*.java',
    'private/core-extension-gitlab-vulnerability-report/src/main/**/*.java')

gitlab_provisioning_task_template: &IS_GITLAB_PROVISIONING_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude('private/core-extension-gitlab-provisioning/**/*.java')

azure_task_template: &IS_AZURE_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude(
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/azuredevops/**/*.java',
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/azuredevops/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/azure/**/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/azure/*.java')

bitbucket_server_task_template: &IS_BITBUCKET_SERVER_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude(
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/bitbucketserver/**/*.java',
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/bitbucketserver/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/bitbucketserver/**/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/bitbucketserver/*.java')

bitbucket_cloud_task_template: &IS_BITBUCKET_CLOUD_TASK_NEEDED >-
    $CIRRUS_BRANCH == $BRANCH_MAIN || $CIRRUS_BRANCH =~ $BRANCH_PATTERN_MAINTENANCE || $CIRRUS_BRANCH == $BRANCH_NIGHTLY ||
    changesInclude(
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/bitbucket/**/*.java',
    'private/core-extension-developer-server/src/main/java/com/sonarsource/branch/pr/bitbucket/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/bitbucketcloud/**/*.java',
    'private/it-branch/it-tests/src/test/java/com/sonarsource/branch/it/suite/pr/bitbucketcloud/*.java')

docker_build_container_template: &CONTAINER_TEMPLATE
  region: eu-central-1
  cluster_name: ${CIRRUS_CLUSTER_NAME}
  namespace: default
  builder_subnet_id: ${CIRRUS_AWS_SUBNET}
  builder_role: cirrus-builder
  builder_image: docker-builder-v*
  builder_instance_type: t2.small
  dockerfile: private/docker/Dockerfile-build
  docker_arguments:
    CIRRUS_AWS_ACCOUNT: ${CIRRUS_AWS_ACCOUNT}
  cpu: 1
  memory: 2Gb

vm_instance_template: &VM_TEMPLATE
  experimental: true # see https://github.com/cirruslabs/cirrus-ci-docs/issues/1051
  image: docker-builder-v*
  type: t2.small
  region: eu-central-1
  subnet_id: ${CIRRUS_AWS_SUBNET}
  disk: 10
  cpu: 4
  memory: 8G

t2xlarge_node_selector: &T2XLARGE_NODE_SELECTOR
  nodeSelectorTerms:
    - matchExpressions:
        - key: node.kubernetes.io/instance-type
          operator: In
          values: t2.xlarge

mssql_additional_container_template: &MSSQL_ADDITIONAL_CONTAINER_TEMPLATE
  name: mssql
  image: mcr.microsoft.com/mssql/server:2022-latest
  port: 1433
  cpu: 2
  memory: 5Gb
  env:
    MSSQL_PID: Developer # this is the default edition
    ACCEPT_EULA: Y
    SA_PASSWORD: sonarqube!1

oracle_additional_container_template: &ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  name: oracle
  image: gvenzl/oracle-xe:21-faststart
  port: 1521
  cpu: 2
  memory: 5Gb
  env:
    ORACLE_PASSWORD: sonarqube
    APP_USER: sonarqube
    APP_USER_PASSWORD: sonarqube

postgres_additional_container_template: &POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  name: postgres
  image: public.ecr.aws/docker/library/postgres:15
  port: 5432
  cpu: 1
  memory: 1Gb
  env:
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres

gitlab_container_template: &GITLAB_CONTAINER_TEMPLATE
  name: gitlab
  ports:
    - 80
    - 443
  cpu: 2
  memory: 8Gb
  image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/gitlab:${GITLAB_VERSION}
  env:
    - GITLAB_POST_RECONFIGURE_SCRIPT: |-
        { cat >/tmp/setup.rb <<-'EOF'
          token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'token');
          token.set_token('token-here-456');
          token.expires_at = Date.today+10.day
          token.save!;
          token_read = User.find_by_username('root').personal_access_tokens.create(scopes: [:read_user], name: 'token_read');
          token_read.set_token('token-read-123');
          token_read.expires_at = Date.today+10.day
          token_read.save!;
          user = User.find_by_username('root');
          user.password = 'eng-YTU1ydh6kyt7tjd';
          user.password_confirmation = 'eng-YTU1ydh6kyt7tjd';
          user.save!;
        EOF
        } && gitlab-rails runner /tmp/setup.rb && \
        echo 'from_file "/etc/gitlab/external_gitlab.rb"' >> /etc/gitlab/gitlab.rb && \
        gitlab-ctl reconfigure

keycloak_container_template: &KEYCLOAK_CONTAINER_TEMPLATE
  name: keycloak
  image: quay.io/keycloak/keycloak:22.0.5
  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

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/**/*"
    log_artifacts:
      path: "**/build/**/*.log"
  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 \
        private/core-extension-developer-server/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" \) | sort | xargs cat

jar_cache_template: &JAR_CACHE_TEMPLATE
  jar_cache:
    folder: "**/build/libs/*.jar"
    fingerprint_key: jar-cache_$CIRRUS_BUILD_ID

eslint_report_cache_template: &ESLINT_REPORT_CACHE_TEMPLATE
  eslint_report_cache:
    folders:
      - server/sonar-web/eslint-report/
      - server/sonar-web/design-system/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/
      - server/sonar-web/design-system/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

default_template: &DEFAULT_TEMPLATE
  skip: *IS_BRANCH_PUBLIC
  clone_script: |
    git init
    git remote add origin https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git
    git fetch origin $CIRRUS_CHANGE_IN_REPO $FETCH_DEPTH
    git reset --hard $CIRRUS_CHANGE_IN_REPO
  env:
    FETCH_DEPTH: --depth=1

cache_dependencies_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2
    memory: 4Gb
  script:
    - ./private/cirrus/cirrus-cache-dependencies.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

build_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 8Gb
  script:
    - ./private/cirrus/cirrus-build.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

publish_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 4
    memory: 4Gb
  env:
    ORG_GRADLE_PROJECT_signingKey: VAULT[development/kv/data/sign data.key]
    ORG_GRADLE_PROJECT_signingPassword: VAULT[development/kv/data/sign data.passphrase]
    ORG_GRADLE_PROJECT_signingKeyId: VAULT[development/kv/data/sign data.key_id]
  script:
    - ./private/cirrus/cirrus-publish.sh

yarn_lint_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *ESLINT_REPORT_CACHE_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 6Gb
  script:
    - ./private/cirrus/cirrus-yarn-lint-report.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_check_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 5Gb
  script: |
    source cirrus-env YARN
    gradle yarn_check-ci --profile
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

yarn_validate_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *YARN_CACHE_TEMPLATE
  <<: *JEST_REPORT_CACHE_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 25Gb
  script:
    - ./private/cirrus/cirrus-yarn-validate-ci.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

junit_task:
  <<: *DEFAULT_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JUNIT_REPORT_CACHE_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 10Gb
  script:
    - ./private/cirrus/cirrus-junit.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

sq_analysis_task:
  skip: *IS_OLD_COMMIT_OR_BRANCH_PUBLIC
  <<: *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
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 7.5
    memory: 15Gb
  script:
    - ./private/cirrus/cirrus-sq-analysis.sh
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

task: #bitbucket
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_BITBUCKET_SERVER_TASK_NEEDED
  eks_container:
    <<: *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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_BITBUCKET_CLOUD_TASK_NEEDED
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 7Gb
  env:
    QA_CATEGORY: BITBUCKET_CLOUD
    <<: *BITBUCKET_CLOUD_ENVIRONMENT_VARIABLES
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_ha_cluster_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_BRANCH_MASTER_OR_NIGHTLY_OR_MAINTENANCE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 10Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
    <<: *T2XLARGE_NODE_SELECTOR
  env:
    QA_CATEGORY: HA_CLUSTER
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_ha_elasticsearch_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_BRANCH_MASTER_OR_NIGHTLY_OR_MAINTENANCE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
    <<: *T2XLARGE_NODE_SELECTOR
  env:
    QA_CATEGORY: HA_ELASTICSEARCH
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_performance_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_BRANCH_MASTER_OR_NIGHTLY
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    QA_CATEGORY: AnalysisPerformance
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

# 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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_GITLAB_TASK_NEEDED
  depends_on:
    - build
  env:
    QA_CATEGORY: GITLAB
  matrix:
    - name: qa_gitlab_latest
      env:
        - GITLAB_VERSION: latest
    - name: qa_gitlab_oldest
      env:
        - GITLAB_VERSION: 15.6.2-ce.0
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 7Gb
    use_in_memory_disk: true
    additional_containers:
      - <<: *GITLAB_CONTAINER_TEMPLATE

  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_gitlab_cloud_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_GITLAB_TASK_NEEDED
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 7Gb
    use_in_memory_disk: true
  env:
    QA_CATEGORY: GITLAB_CLOUD
    <<: *GITLAB_CLOUD_ENVIRONMENT_VARIABLES
  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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_AZURE_TASK_NEEDED
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 7Gb
  env:
    QA_CATEGORY: AZURE
    <<: *AZURE_CLOUD_ENVIRONMENT_VARIABLES
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_github_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_GITHUB_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 4
    memory: 7Gb
  env:
    QA_CATEGORY: GITHUB
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_github_provisioning_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_GITHUB_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 4
    memory: 7Gb
  env:
    QA_CATEGORY: GITHUB_PROVISIONING
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_gitlab_provisioning_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  only_if: *IS_GITLAB_PROVISIONING_TASK_NEEDED
  env:
    QA_CATEGORY: GITLAB_PROVISIONING
  matrix:
    - name: qa_gitlab_provisioning_latest
      env:
        - GITLAB_VERSION: latest
    - name: qa_gitlab_provisioning_oldest
      env:
        - GITLAB_VERSION: 15.6.2-ce.0
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 7Gb
    use_in_memory_disk: true
    additional_containers:
      - <<: *GITLAB_CONTAINER_TEMPLATE
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

qa_github_slow_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_GITHUB_TASK_NEEDED
  skip: *IS_BRANCH_MASTER
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 4
    memory: 7Gb
  env:
    QA_CATEGORY: GITHUB_SLOW_TESTS
    GITHUB_COM_CODE_SCANNING_ALERTS_TECHNICAL_USER_USERNAME: QA-task
    GITHUB_COM_CODE_SCANNING_ALERTS_TECHNICAL_USER_TOKEN: VAULT[development/github/token/SonarSource-sonar-enterprise-code-scanning token]
  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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_SAML_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
    additional_containers:
      - <<: *KEYCLOAK_CONTAINER_TEMPLATE
  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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_LDAP_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2.4
    memory: 10Gb
  env:
    QA_CATEGORY: LDAP
  script:
    - ./private/cirrus/cirrus-qa.sh h2
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

promote_task:
  <<: *DEFAULT_TEMPLATE
  skip: *IS_OLD_COMMIT
  depends_on:
    - build
    - sq_analysis
    - qa
    - qa_saml
    - qa_ldap
    - publish
  eks_container:
    <<: *CONTAINER_TEMPLATE
    memory: 512M
  stateful: true
  script:
    - ./private/cirrus/cirrus-promote.sh

package_docker_task:
  <<: *DEFAULT_TEMPLATE
  only_if: *IS_BRANCH_MASTER
  skip: *IS_OLD_COMMIT
  depends_on: promote
  ec2_instance:
    <<: *VM_TEMPLATE
  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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *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:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *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_postgres11_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
        image: public.ecr.aws/docker/library/postgres:11
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

sql_oracle21_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    memory: 5Gb
    additional_containers:
      - <<: *ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  script:
    - ./private/cirrus/cirrus-db-unit-test.sh oracle21
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

upgd_mssql_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 1.5
    memory: 6Gb
    additional_containers:
      - <<: *MSSQL_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh mssql
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

upgd_oracle21_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_DB_TASK_NEEDED
  <<: *JAR_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 1.5
    memory: 6Gb
    additional_containers:
      - <<: *ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  env:
    QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh oracle21
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

mend_scan_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  only_if: *IS_BRANCH_MASTER_OR_NIGHTLY_OR_MAINTENANCE
  <<: *YARN_CACHE_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  timeout_in: 30m
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 2
    memory: 4Gb
  env:
    WS_APIKEY: VAULT[development/kv/data/mend data.apikey]
    WS_WSS_URL: VAULT[development/kv/data/mend data.url]
    WS_USERKEY: VAULT[development/kv/data/mend data.userKey]
    SLACK_WEBHOOK_SQ: VAULT[development/kv/data/slack data.webhook]
  mend_script:
    - ./private/cirrus/cirrus-mend-scan.sh
  allow_failures: "true"
  on_failure:
    slack_notification_script:
      - ./private/cirrus/cirrus-mend-notifications.sh
  always:
    ws_artifacts:
      path: "whitesource/**/*"

qa_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  skip: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 7Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  name: QA $QA_CATEGORY
  alias: qa
  env:
    matrix:
      # QA name should not exceed 13 characters to be properly reported on wallboard by burgr
      # QA name cannot contain "_"
      - QA_CATEGORY: Cat1
      - QA_CATEGORY: Cat2
      - QA_CATEGORY: Cat3
      - QA_CATEGORY: Cat4
      - QA_CATEGORY: Cat5
      - QA_CATEGORY: Cat6
      - QA_CATEGORY: Analysis
      - QA_CATEGORY: Authorization
      - QA_CATEGORY: Auth
      - QA_CATEGORY: Branch1
      - QA_CATEGORY: Branch2
      - QA_CATEGORY: CE1
      - QA_CATEGORY: CE2
      - QA_CATEGORY: ComputeEngine
      - QA_CATEGORY: DE1
      - QA_CATEGORY: DE2
      - QA_CATEGORY: EE1
      - QA_CATEGORY: EE2
      - QA_CATEGORY: Issues1
      - QA_CATEGORY: Issues2
      - QA_CATEGORY: License1
      - QA_CATEGORY: License2
      - QA_CATEGORY: Plugins
      - QA_CATEGORY: Project
      - QA_CATEGORY: QP
      - QA_CATEGORY: Upgrade
  script:
    - ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

weekly_postgres_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  only_if: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 7Gb
    additional_containers:
      - <<: *POSTGRES_ADDITIONAL_CONTAINER_TEMPLATE
  alias: weekly-qa
  env:
    GITLAB_VERSION: latest
    <<: *BITBUCKET_CLOUD_ENVIRONMENT_VARIABLES
    <<: *GITLAB_CLOUD_ENVIRONMENT_VARIABLES
    <<: *AZURE_CLOUD_ENVIRONMENT_VARIABLES
    matrix:
      # QA name should not exceed 13 characters to be properly reported on wallboard by burgr
      # QA name cannot contain "_"
      - QA_CATEGORY: Cat1
      - QA_CATEGORY: Cat2
      - QA_CATEGORY: Cat3
      - QA_CATEGORY: Cat4
      - QA_CATEGORY: Cat5
      - QA_CATEGORY: Cat6
      - QA_CATEGORY: Analysis
      - QA_CATEGORY: Authorization
      - QA_CATEGORY: Auth
      - QA_CATEGORY: Branch1
      - QA_CATEGORY: Branch2
      - QA_CATEGORY: CE1
      - QA_CATEGORY: CE2
      - QA_CATEGORY: ComputeEngine
      - QA_CATEGORY: DE1
      - QA_CATEGORY: DE2
      - QA_CATEGORY: EE1
      - QA_CATEGORY: EE2
      - QA_CATEGORY: Issues1
      - QA_CATEGORY: Issues2
      - QA_CATEGORY: License1
      - QA_CATEGORY: License2
      - QA_CATEGORY: Plugins
      - QA_CATEGORY: Project
      - QA_CATEGORY: QP
      - QA_CATEGORY: Upgrade
      - QA_CATEGORY: AnalysisPerformance
      - QA_CATEGORY: LDAP
      - QA_CATEGORY: BITBUCKET_CLOUD
      - QA_CATEGORY: GITLAB_CLOUD
      - QA_CATEGORY: AZURE
      - QA_CATEGORY: MIGRATION
      #- QA_CATEGORY: GITHUB needs to be disabled because the tests in this package fail when running a scanner
      #- QA_CATEGORY: GITHUB_PROVISIONING needs to be disabled because tests fail with dangling connection problem
      #- QA_CATEGORY: HA needs to be disabled because otherwise we would be assigning big container to each category
  maven_cache:
    folder: ~/.m2
  name: Postgres 15 $QA_CATEGORY
  script: ./private/cirrus/cirrus-qa.sh postgres
  <<: *DEFAULT_ARTIFACTS_TEMPLATE


weekly_oracle_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  only_if: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 7Gb
    additional_containers:
      - <<: *ORACLE_ADDITIONAL_CONTAINER_TEMPLATE
  alias: weekly-qa
  env:
    GITLAB_VERSION: latest
    <<: *BITBUCKET_CLOUD_ENVIRONMENT_VARIABLES
    <<: *GITLAB_CLOUD_ENVIRONMENT_VARIABLES
    <<: *AZURE_CLOUD_ENVIRONMENT_VARIABLES
    matrix:
      # QA name should not exceed 13 characters to be properly reported on wallboard by burgr
      # QA name cannot contain "_"
      - QA_CATEGORY: Cat1
      - QA_CATEGORY: Cat2
      - QA_CATEGORY: Cat3
      - QA_CATEGORY: Cat4
      - QA_CATEGORY: Cat5
      - QA_CATEGORY: Cat6
      - QA_CATEGORY: Analysis
      - QA_CATEGORY: Authorization
      - QA_CATEGORY: Auth
      - QA_CATEGORY: Branch1
      - QA_CATEGORY: Branch2
      - QA_CATEGORY: CE1
      #- QA_CATEGORY: CE2 needs to be disabled because the tests in SonarLintServerPushTest are very slow on Oracle SONAR-21036
      - QA_CATEGORY: ComputeEngine
      - QA_CATEGORY: DE1
      - QA_CATEGORY: DE2
      - QA_CATEGORY: EE1
      - QA_CATEGORY: EE2
      - QA_CATEGORY: Issues1
      - QA_CATEGORY: Issues2
      - QA_CATEGORY: License1
      - QA_CATEGORY: License2
      - QA_CATEGORY: Plugins
      - QA_CATEGORY: Project
      - QA_CATEGORY: QP
      - QA_CATEGORY: Upgrade
      - QA_CATEGORY: AnalysisPerformance
      - QA_CATEGORY: LDAP
      - QA_CATEGORY: BITBUCKET_CLOUD
      - QA_CATEGORY: GITLAB_CLOUD
      - QA_CATEGORY: AZURE
      - QA_CATEGORY: MIGRATION
      #- QA_CATEGORY: GITHUB needs to be disabled because the tests in this package fail when running a scanner
      #- QA_CATEGORY: GITHUB_PROVISIONING needs to be disabled because tests fail with dangling connection problem
      #- QA_CATEGORY: HA needs to be disabled because otherwise we would be assigning big container to each category
  maven_cache:
    folder: ~/.m2
  name: Oracle 21 XE $QA_CATEGORY
  script: ./private/cirrus/cirrus-qa.sh oracle21
  <<: *DEFAULT_ARTIFACTS_TEMPLATE

weekly_mssql_task:
  <<: *DEFAULT_TEMPLATE
  <<: *BUILD_DEPENDANT_TASK_TEMPLATE
  <<: *CACHE_DEPENDENCIES_DEPENDANT_TASK_TEMPLATE
  <<: *GRADLE_CACHE_TEMPLATE
  <<: *JAR_CACHE_TEMPLATE
  only_if: *IS_WEEKLY_JOB
  eks_container:
    <<: *CONTAINER_TEMPLATE
    cpu: 3
    memory: 7Gb
    additional_containers:
      - <<: *MSSQL_ADDITIONAL_CONTAINER_TEMPLATE
  alias: weekly-qa
  env:
    GITLAB_VERSION: latest
    <<: *BITBUCKET_CLOUD_ENVIRONMENT_VARIABLES
    <<: *GITLAB_CLOUD_ENVIRONMENT_VARIABLES
    <<: *AZURE_CLOUD_ENVIRONMENT_VARIABLES
    matrix:
      # QA name should not exceed 13 characters to be properly reported on wallboard by burgr
      # QA name cannot contain "_"
      - QA_CATEGORY: Cat1
      - QA_CATEGORY: Cat2
      - QA_CATEGORY: Cat3
      - QA_CATEGORY: Cat4
      - QA_CATEGORY: Cat5
      - QA_CATEGORY: Cat6
      - QA_CATEGORY: Analysis
      - QA_CATEGORY: Authorization
      - QA_CATEGORY: Auth
      - QA_CATEGORY: Branch1
      - QA_CATEGORY: Branch2
      - QA_CATEGORY: CE1
      - QA_CATEGORY: CE2
      - QA_CATEGORY: ComputeEngine
      - QA_CATEGORY: DE1
      - QA_CATEGORY: DE2
      - QA_CATEGORY: EE1
      - QA_CATEGORY: EE2
      - QA_CATEGORY: Issues1
      - QA_CATEGORY: Issues2
      - QA_CATEGORY: License1
      - QA_CATEGORY: License2
      - QA_CATEGORY: Plugins
      - QA_CATEGORY: Project
      - QA_CATEGORY: QP
      - QA_CATEGORY: Upgrade
      - QA_CATEGORY: AnalysisPerformance
      - QA_CATEGORY: LDAP
      - QA_CATEGORY: BITBUCKET_CLOUD
      - QA_CATEGORY: GITLAB_CLOUD
      - QA_CATEGORY: AZURE
      - QA_CATEGORY: MIGRATION
      #- QA_CATEGORY: GITHUB needs to be disabled because the tests in this package fail when running a scanner
      #- QA_CATEGORY: GITHUB_PROVISIONING needs to be disabled because tests fail with dangling connection problem
      #- QA_CATEGORY: HA needs to be disabled because otherwise we would be assigning big container to each category
  maven_cache:
    folder: ~/.m2
  name: MSSQL 2022 $QA_CATEGORY
  script: ./private/cirrus/cirrus-qa.sh mssql
  <<: *DEFAULT_ARTIFACTS_TEMPLATE