-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy path.evergreen-functions.yml
More file actions
902 lines (828 loc) · 28.1 KB
/
Copy path.evergreen-functions.yml
File metadata and controls
902 lines (828 loc) · 28.1 KB
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
variables:
- &e2e_include_expansions_in_env
include_expansions_in_env:
- cognito_user_pool_id
- cognito_workload_federation_client_id
- cognito_user_name
- cognito_workload_federation_client_secret
- cognito_user_password
- cognito_workload_url
- cognito_workload_user_id
- ARTIFACTORY_PASSWORD
- ARTIFACTORY_USERNAME
- GRS_PASSWORD
- GRS_USERNAME
- OVERRIDE_VERSION_ID
- PKCS11_URI
- branch_name
- build_id
- build_variant
- distro
- e2e_cloud_qa_apikey_owner_ubi_cloudqa
- e2e_cloud_qa_orgid_owner_ubi_cloudqa
- e2e_cloud_qa_user_owner_ubi_cloudqa
- ecr_registry
- ecr_registry_needs_auth
- execution
- github_commit
- image_name
- is_patch
- mms_eng_test_aws_access_key
- mms_eng_test_aws_region
- mms_eng_test_aws_secret
- openshift_token
- openshift_url
- otel_collector_endpoint
- otel_parent_id
- otel_trace_id
- registry
- requester
- task_name
- triggered_by_git_tag
- version_id
- workdir
# temporary secret to pull community private preview image from quay.io
- community_private_preview_pullsecret_dockerconfigjson
- RELEASE_INITIAL_VERSION
- RELEASE_INITIAL_COMMIT_SHA
- OPERATOR_VERSION
- READINESS_PROBE_VERSION
- VERSION_UPGRADE_HOOK_VERSION
- BUILD_SCENARIO
functions:
### Setup Functions ###
setup_jq: &setup_jq
command: subprocess.exec
type: setup
params:
<<: *e2e_include_expansions_in_env
add_to_path:
- ${workdir}/bin
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/setup_jq.sh
setup_context: &setup_context # Running the first switch is important to fill the workdir and other important initial env vars
command: shell.exec
type: setup
params:
add_to_path:
- ${workdir}/bin
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
<<: *e2e_include_expansions_in_env
script: |
echo "Initializing context files"
cp scripts/dev/contexts/evg-private-context scripts/dev/contexts/private-context
scripts/dev/switch_context.sh root-context
echo "Finished initializing to the root context"
switch_context: &switch_context
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
<<: *e2e_include_expansions_in_env
add_to_path:
- ${workdir}/bin
- ${workdir}/google-cloud-sdk/bin
command: scripts/dev/switch_context.sh "${build_variant}"
python_venv: &python_venv
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
command: scripts/dev/recreate_python_venv.sh
"clone":
- command: subprocess.exec
type: setup
params:
command: "mkdir -p src/github.com/mongodb"
- command: git.get_project
type: setup
params:
directory: src/github.com/mongodb/mongodb-kubernetes
- command: subprocess.exec
type: setup
params:
command: "git config --global user.name 'Evergreen'"
- command: subprocess.exec
type: setup
params:
command: "git config --global user.email 'kubernetes-hosted-team@mongodb.com'"
- *setup_jq # we need jq in the context
- *setup_context
setup_kubectl: &setup_kubectl
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/setup_kubectl.sh
setup_shellcheck:
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/setup_shellcheck.sh
setup_aws: &setup_aws
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/setup_aws.sh
setup_gcloud_cli:
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- GCP_SERVICE_ACCOUNT_JSON_FOR_SNIPPETS_TESTS
add_to_path:
- ${workdir}/google-cloud-sdk/bin
binary: scripts/evergreen/setup_gcloud_cli.sh
setup_mongosh:
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/google-cloud-sdk/bin
binary: scripts/evergreen/setup_mongosh.sh
# configures Docker size, installs the Kind binary (if necessary)
setup_kind: &setup_kind
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/setup_kind.sh
setup_preflight:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/setup_preflight.sh
setup_prepare_openshift_bundles:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/setup_yq.sh
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/setup_prepare_openshift_bundles.sh
install_olm:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/operator-sdk/install-olm.sh
prepare_openshift_bundles_for_e2e:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh
setup_docker_sbom:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/setup_docker_sbom.sh
# Logs into all used registries
configure_docker_auth: &configure_docker_auth
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/dev/configure_container_auth.sh
setup_evg_host: &setup_evg_host
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/dev/setup_evg_host.sh
setup_chart_testing_cli: &setup_chart_testing_cli
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/dev/setup_chart_testing_cli.sh
lint_repo:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/setup_yq.sh
- *setup_chart_testing_cli
- command: subprocess.exec
type: test
params:
add_to_path:
- ${workdir}/bin
- ${workdir}/venv/bin
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/check_precommit.sh
# Configures docker authentication to ECR and RH registries.
setup_building_host:
- *python_venv
- *setup_aws
- *setup_evg_host
- *configure_docker_auth
# This differs for normal evg_host as we require minikube instead of kind for
# IBM machines also install aws cli via pip instead and use podman
setup_building_host_minikube:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/setup_minikube_host.sh
prune_docker_resources:
- command: shell.exec
type: setup
params:
shell: bash
script: |
if command -v docker >/dev/null 2>&1; then
echo "Docker found, pruning docker resources..."
docker system prune -a -f
else
echo "Docker not found, skipping docker resource pruning"
fi
# the task configures the set of tools necessary for any task working with K8 cluster:
# installs kubectl, jq, kind (if necessary), configures docker authentication
download_kube_tools:
- *setup_kubectl
- *setup_jq
# we need aws to configure docker authentication
- *setup_aws
- *configure_docker_auth
- *setup_kind
teardown_kubernetes_environment:
- command: shell.exec
type: setup
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
scripts/evergreen/teardown_kubernetes_environment.sh
# Makes sure a kubectl context is defined.
setup_kubernetes_environment_p: &setup_kubernetes_environment_p
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/setup_kubernetes_environment.sh
setup_kubernetes_environment:
- *setup_kubernetes_environment_p
# After setting up KUBE, we need to update the KUBECONFIG and other env vars.
- *switch_context
# cleanup_exec_environment is a very generic name when the only thing this function
# does is to clean the logs directory. In the future, more "commands" can be
# added to it with more clearing features, when needed.
cleanup_exec_environment:
- command: shell.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
rm -rf logs
quay_login:
- command: subprocess.exec
type: setup
params:
command: "docker login quay.io -u ${quay_prod_username} -p ${quay_prod_robot_token}"
setup_cloud_qa:
- command: shell.exec
type: setup
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
scripts/dev/run_python.sh scripts/evergreen/e2e/setup_cloud_qa.py create
# The additional switch is needed, since we now have created the needed OM exports.
- *switch_context
teardown_cloud_qa:
- command: shell.exec
type: setup
params:
continue_on_err: true
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
scripts/dev/run_python.sh scripts/evergreen/e2e/setup_cloud_qa.py delete
dump_diagnostic_information_from_all_namespaces:
- command: subprocess.exec
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- bin
binary: scripts/evergreen/e2e/dump_diagnostic_information_from_all_namespaces.sh
### Publish and release image ###
# Tags and pushes an image into an external Docker registry. The source image
# needs to exist before it can be pushed to a remote registry.
# It is expected that IMAGE_SOURCE is accessible with no authentication (like a
# local image), and the IMAGE_TARGET will be authenticated with DOCKER_* series of
# environment variables.
release_docker_image_to_registry:
- command: subprocess.exec
type: system
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
include_expansions_in_env:
- tag_source
- tag_dest
- image_source
- image_target
- docker_username
- docker_password
binary: scripts/evergreen/tag_push_docker_image.sh
#
# Performs some AWS cleanup
#
prepare_aws: &prepare_aws
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/prepare_aws.sh
build-dockerfiles:
- command: subprocess.exec
type: setup
params:
add_to_path:
- ${workdir}/bin
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/dev/run_python.sh scripts/update_supported_dockerfiles.py
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- triggered_by_git_tag
# if you ever change the target folder structure, the same needs to be reflected in PCT
command: "tar -czvf ./public/dockerfiles-${triggered_by_git_tag}.tgz ./public/dockerfiles"
enable_QEMU:
- command: shell.exec
type: setup
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
echo "Enabling QEMU building for Docker"
docker run --rm --privileged 268558157000.dkr.ecr.eu-west-1.amazonaws.com/docker-hub-mirrors/multiarch/qemu-user-static --reset -p yes
# upload_e2e_logs has the responsibility of dumping as much information as
# possible into the S3 bucket that corresponds to this ${version}. The
# Kubernetes cluster where the test finished running, should still be
# reachable. Note that after a timeout, Evergreen kills the running process
# and any running container in the host (which kills Kind).
upload_e2e_logs:
- command: s3.put
params:
continue_on_err: true
aws_key: ${enterprise_aws_access_key_id}
aws_secret: ${enterprise_aws_secret_access_key}
local_files_include_filter:
- src/github.com/mongodb/mongodb-kubernetes/logs/*
remote_file: logs/${task_id}/${execution}/
bucket: operator-e2e-artifacts
permissions: private
visibility: signed
content_type: text/plain
- command: attach.xunit_results
params:
continue_on_err: true
file: "src/github.com/mongodb/mongodb-kubernetes/logs/myreport.xml"
upload_e2e_logs_gotest:
- command: s3.put
params:
aws_key: ${enterprise_aws_access_key_id}
aws_secret: ${enterprise_aws_secret_access_key}
local_files_include_filter:
- src/github.com/mongodb/mongodb-kubernetes/logs/*
remote_file: logs/${task_id}/${execution}/
bucket: operator-e2e-artifacts
permissions: private
visibility: signed
content_type: text/plain
- command: gotest.parse_files
params:
files: [ "src/github.com/mongodb/mongodb-kubernetes/logs/*.suite" ]
preflight_image:
- command: subprocess.exec
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
include_expansions_in_env:
- image_version
- rh_pyxis
binary: scripts/dev/run_python.sh scripts/preflight_images.py --image ${image_name} --submit "${preflight_submit}"
build_multi_cluster_binary:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/build_multi_cluster_kubeconfig_creator.sh
build_and_push_appdb_database:
- command: subprocess.exec
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-appdb-database
binary: ./build_and_push_appdb_database_images.sh
add_to_path:
- ${workdir}/bin
- ${workdir}
build_test_image_ibm:
- command: subprocess.exec
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/e2e/build_tests_image_ibm.sh
pipeline:
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/pipeline.sh
env:
IMAGE_NAME: ${IMAGE_NAME}
pipeline_agent:
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/pipeline_agent.sh
env:
FLAGS: ${FLAGS}
pipeline_ops_manager:
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/pipeline_ops_manager.sh
pipeline_readiness_probe:
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/pipeline_readiness_probe.sh
pipeline_version_upgrade_hook:
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/release/pipeline_version_upgrade_hook.sh
teardown_cloud_qa_all:
- command: shell.exec
type: setup
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
scripts/dev/run_python.sh scripts/evergreen/e2e/setup_cloud_qa.py delete_all
# Updates current expansions with variables from release.json file.
# Use e.g. ${mongoDbOperator} afterwards.
update_evergreen_expansions:
- command: subprocess.exec
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: "scripts/evergreen/generate_evergreen_expansions.sh"
- command: expansions.update
params:
file: "src/github.com/mongodb/mongodb-kubernetes/evergreen_expansions.yaml"
# Uploads openshift bundle specified by bundle_file_name argument.
upload_openshift_bundle:
- command: s3.put
params:
aws_key: ${enterprise_aws_access_key_id}
aws_secret: ${enterprise_aws_secret_access_key}
local_file: src/github.com/mongodb/mongodb-kubernetes/bundle/${bundle_file_name}
remote_file: bundles/${bundle_file_name}
bucket: operator-e2e-bundles
permissions: public-read
content_type: application/x-binary
prepare_openshift_bundles:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
command: scripts/evergreen/operator-sdk/prepare-openshift-bundles.sh
# Performs some AWS cleanup
cleanup_aws:
- *setup_jq
- *setup_aws
- *prepare_aws
- command: subprocess.exec
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
add_to_path:
- ${workdir}/bin
# Below script deletes agent images created for an Evergreen patch older than 1 day
command: scripts/dev/run_python.sh scripts/evergreen/periodic-cleanup-aws.py
### Test Functions ###
#
# e2e_test is the main function used to run the e2e tests. It expects Ops
# Manager to be running (local to the Kubernetes cluster or Cloud Manager) and
# its configuration to exist in a ${workdir}/.ops-manager-env file.
#
# The e2e script will run all the tasks that are needed by the e2e tests like
# fetching the OM API credentials to use and create the Secret and ConfigMap
# objects that are required.
#
# At this point, the Kubernetes environment should be configured already
# (kubectl configuration points to the Kubernetes cluster where we run the tests).
#
# Please note: There are many ENV variables passed to the `e2e` script, so try
# to not add more. If this is required, discuss your use case with the team first.
#
e2e_test:
- command: subprocess.exec
type: test
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- otel_parent_id
- branch_name
- github_commit
- revision
- github_pr_number
- project_identifier
- revision_order_id
add_to_path:
- ${workdir}/bin
binary: scripts/evergreen/e2e/e2e.sh
e2e_test_perf:
- command: subprocess.exec
type: test
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- otel_parent_id
- branch_name
- github_commit
- revision
- github_pr_number
- project_identifier
- revision_order_id
add_to_path:
- ${workdir}/bin
env:
PERF_TASK_DEPLOYMENTS: ${PERF_TASK_DEPLOYMENTS}
PERF_TASK_REPLICAS: ${PERF_TASK_REPLICAS}
TEST_NAME_OVERRIDE: ${TEST_NAME_OVERRIDE}
binary: scripts/evergreen/e2e/e2e.sh
test_golang_unit:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make test-race
- command: gotest.parse_files
params:
files: [ "src/github.com/mongodb/mongodb-kubernetes/*.suite", "src/github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/*.suite" ]
test_helm_unit:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make helm-tests
test_python_unit:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make python-tests
test_sboms:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make sbom-tests
generate_perf_tests_tasks:
- command: shell.exec
type: setup
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
scripts/dev/run_python.sh scripts/evergreen/e2e/performance/create_variants.py ${variant} ${size}> evergreen_tasks.json
echo "tasks to run:"
cat evergreen_tasks.json
- command: generate.tasks
params:
files:
- evergreen_tasks.json
### Other ###
run_retry_script:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- EVERGREEN_API_KEY
- EVERGREEN_USER
- evergreen_retry
env:
EVERGREEN_RETRY: ${evergreen_retry}
script: |
scripts/evergreen/retry-evergreen.sh ${version_id}
# This is a generic function for conditionally running given task.
# It works by appending <task> to <variant> if <condition_script> returns no error.
#
# It has 3 input parameters:
# - condition_script: path to the script that will be executed.
# Error code == 0 resulting from the scripts indicates that <task> should be added dynamically to <variant>
# Error code != 0 means that the task will not be executed
# - variant: variant to which task will be appended
# - task: task name to be executed
#
# Example usage:
# - func: run_task_conditionally
# vars:
# condition_script: scripts/evergreen/should_prepare_openshift_bundles.sh
# variant: prepare_openshift_bundles
# task: prepare_and_upload_openshift_bundles
run_task_conditionally:
- command: shell.exec
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
if ${condition_script}; then
echo "Adding ${task} task to ${variant} variant"
scripts/evergreen/add_evergreen_task.sh ${variant} ${task}
else
echo "skipping task ${task} due to ${condition_script} result: $?"
fi
- command: generate.tasks
params:
files:
- evergreen_tasks.json
optional: true
#
# Code snippet test automation
#
sample_commit_output:
- command: github.generate_token
params:
expansion_name: GH_TOKEN
- command: subprocess.exec
params:
include_expansions_in_env:
- GH_TOKEN
- code_snippets_commit_output
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/code_snippets/sample_commit_output.sh
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
test_code_snippets:
- command: shell.exec
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- version_id
- code_snippets_teardown
- code_snippets_reset
- task_name
script: |
./scripts/code_snippets/tests/${task_name}
#
# kubectl mongodb plugin release functions
#
install_goreleaser:
- command: shell.exec
type: setup
include_expansions_in_env:
- goreleaser_pro_tar_gz
params:
script: |
set -Eeu pipefail
curl -fL "${goreleaser_pro_tar_gz}" --output goreleaser_Linux_x86_64.tar.gz
tar -xf goreleaser_Linux_x86_64.tar.gz
chmod 755 ./goreleaser
install_macos_notarization_service:
- command: shell.exec
type: setup
params:
include_expansions_in_env:
- notary_service_url
script: |
set -Eeu pipefail
curl "${notary_service_url}" --output macos-notary.zip
unzip -u macos-notary.zip
chmod 755 ./linux_amd64/macnotary
create_chart_release_pr:
- command: github.generate_token
params:
repo: helm-charts
expansion_name: GH_TOKEN
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- GH_TOKEN
- workdir
- OPERATOR_VERSION
env:
GH_TOKEN: ${GH_TOKEN}
binary: scripts/dev/run_python.sh scripts/release/create_chart_release_pr.py --chart_version ${OPERATOR_VERSION|*triggered_by_git_tag}
release_kubectl_mongodb_plugin:
- command: github.generate_token
params:
expansion_name: generated_token
- command: shell.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-kubernetes
include_expansions_in_env:
- GRS_USERNAME
- GRS_PASSWORD
- PKCS11_URI
- ARTIFACTORY_URL
- ARTIFACTORY_PASSWORD
- SIGNING_IMAGE_URI
- macos_notary_keyid
- macos_notary_secret
- workdir
- triggered_by_git_tag
- OPERATOR_VERSION
env:
XDG_CONFIG_HOME: ${go_base_path}${workdir}
GO111MODULE: "on"
GOROOT: "/opt/golang/go1.24"
MACOS_NOTARY_KEY: ${macos_notary_keyid}
MACOS_NOTARY_SECRET: ${macos_notary_secret}
# shell.exec EVG Task doesn't have add_to_path, so we need to explicitly add the path export below.
script: |
set -Eeu pipefail
export GORELEASER_CURRENT_TAG=${OPERATOR_VERSION|*triggered_by_git_tag}
export PATH=$GOROOT/bin:$PATH
export GITHUB_TOKEN=${generated_token}
${workdir}/goreleaser release --clean