Skip to content

Commit c45bc73

Browse files
authored
Fix switch-context issues + context cleanup (#508)
# Summary The main focus of PR is changing how the `switch_context` function is called. It is removed from most of the functions in `.evergreen-functions.yml` (setup_building_host, setup_building_host_minikube) and instead added directly to task and group variables in `.evergreen.yml`. This allows us to not create a synthetic and empty context file for each task in evergreen. Context file is mostly needed for e2e tasks and not for building images or preflight tasks for example. Other changes: * Removed the `preflight_om_image` task from `.evergreen-tasks.yml`, which is was unnecessary - we run all preflights on master merges and PRs. * Additionally, several unused context files were deleted from the repository. ## Proof of Work Passing CI + tested staging in different PR [run](https://spruce.mongodb.com/version/68e65607b6bd2000074ad206/tasks?page=0&sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC&statuses=failed,setup-failed,started,will-run), because staging builds are not yet supported. ## Checklist - [ ] Have you linked a jira ticket and/or is the ticket in the title? - [ ] Have you checked whether your jira ticket required DOCSP changes? - [ ] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent 41049c8 commit c45bc73

13 files changed

+12
-97
lines changed

.evergreen-functions.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ functions:
267267

268268
# Configures docker authentication to ECR and RH registries.
269269
setup_building_host:
270-
- *switch_context
271270
- *python_venv
272271
- *setup_aws
273272
- *setup_evg_host
@@ -276,7 +275,6 @@ functions:
276275
# This differs for normal evg_host as we require minikube instead of kind for
277276
# IBM machines also install aws cli via pip instead and use podman
278277
setup_building_host_minikube:
279-
- *switch_context
280278
- command: subprocess.exec
281279
type: setup
282280
params:
@@ -350,7 +348,6 @@ functions:
350348
command: "docker login quay.io -u ${quay_prod_username} -p ${quay_prod_robot_token}"
351349

352350
setup_cloud_qa:
353-
- *switch_context
354351
- command: shell.exec
355352
type: setup
356353
params:
@@ -481,7 +478,6 @@ functions:
481478
files: [ "src/github.com/mongodb/mongodb-kubernetes/logs/*.suite" ]
482479

483480
preflight_image:
484-
- *switch_context
485481
- command: subprocess.exec
486482
params:
487483
working_dir: src/github.com/mongodb/mongodb-kubernetes
@@ -509,7 +505,6 @@ functions:
509505
- ${workdir}
510506

511507
build_test_image_ibm:
512-
- *switch_context
513508
- command: subprocess.exec
514509
params:
515510
shell: bash
@@ -521,7 +516,6 @@ functions:
521516
binary: scripts/evergreen/e2e/build_tests_image_ibm.sh
522517

523518
pipeline_migrate_agents:
524-
- *switch_context
525519
- command: subprocess.exec
526520
retry_on_failure: false
527521
type: setup
@@ -532,7 +526,6 @@ functions:
532526
binary: scripts/release/pipeline_migrate_agent.sh
533527

534528
pipeline:
535-
- *switch_context
536529
- command: subprocess.exec
537530
retry_on_failure: true
538531
type: setup
@@ -544,7 +537,6 @@ functions:
544537

545538
# TODO: this function is very similar to pipeline and it will joined with it in the future
546539
release_operator_pipeline:
547-
- *switch_context
548540
- command: subprocess.exec
549541
retry_on_failure: true
550542
type: setup
@@ -556,7 +548,6 @@ functions:
556548
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py ${image_name} --build-scenario release --version ${RELEASE_OPERATOR_VERSION|*triggered_by_git_tag}
557549

558550
teardown_cloud_qa_all:
559-
- *switch_context
560551
- command: shell.exec
561552
type: setup
562553
params:
@@ -712,7 +703,6 @@ functions:
712703
make sbom-tests
713704
714705
generate_perf_tests_tasks:
715-
- *switch_context
716706
- command: shell.exec
717707
type: setup
718708
params:
@@ -797,7 +787,6 @@ functions:
797787

798788
# it executes a script by convention: ./scripts/code_snippets/tests/${task_name}
799789
test_code_snippets:
800-
- *switch_context
801790
- command: shell.exec
802791
params:
803792
shell: bash

.evergreen-snippets.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ variables:
66
- func: setup_gcloud_cli
77
- func: setup_mongosh
88
- func: download_kube_tools
9+
- func: switch_context
910
- func: build_multi_cluster_binary
1011
teardown_task:
1112
- func: upload_e2e_logs
@@ -20,6 +21,7 @@ variables:
2021
- func: cleanup_exec_environment
2122
- func: download_kube_tools
2223
- func: configure_docker_auth
24+
- func: switch_context
2325
- func: setup_kubernetes_environment
2426
- func: python_venv
2527
- func: setup_cloud_qa

.evergreen-tasks.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ tasks:
6060
vars:
6161
image_name: mongodb-agent
6262

63-
- name: preflight_om_image
64-
tags: [ "image_preflight" ]
65-
commands:
66-
- func: clone
67-
- func: python_venv
68-
- func: setup_preflight
69-
- func: preflight_image
70-
vars:
71-
image_name: ops-manager
72-
7363
# Code snippets tasks
7464
# Each task is selected by convention by running scripts/code_snippets/${task_name}_test.sh
7565
- name: task_gke_multi_cluster_snippets

.evergreen.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ variables:
7171
setup_group:
7272
- func: clone
7373
- func: download_kube_tools
74+
- func: switch_context
7475
- func: setup_building_host
7576

7677
- &setup_group_ibm
7778
setup_group_can_fail_task: true
7879
setup_group:
7980
- func: clone
81+
- func: switch_context
8082
- func: setup_building_host_minikube
8183
- func: build_multi_cluster_binary
8284

@@ -85,6 +87,7 @@ variables:
8587
setup_group:
8688
- func: clone
8789
- func: download_kube_tools
90+
- func: switch_context
8891
- func: setup_building_host
8992
- func: build_multi_cluster_binary
9093

@@ -93,6 +96,7 @@ variables:
9396
setup_task:
9497
- func: cleanup_exec_environment
9598
- func: configure_docker_auth
99+
- func: switch_context
96100
- func: setup_kubernetes_environment
97101
- func: setup_cloud_qa
98102
teardown_task_can_fail_task: true
@@ -107,6 +111,7 @@ variables:
107111
- func: cleanup_exec_environment
108112
- func: configure_docker_auth
109113
- func: setup_kubernetes_environment
114+
- func: switch_context
110115
teardown_task_can_fail_task: true
111116
teardown_task:
112117
- func: upload_e2e_logs
@@ -464,6 +469,7 @@ tasks:
464469
- name: generate_perf_tasks_one_thread
465470
commands:
466471
- func: clone
472+
- func: switch_context
467473
- func: generate_perf_tests_tasks
468474
vars:
469475
variant: e2e_operator_perf_one_thread
@@ -472,6 +478,7 @@ tasks:
472478
- name: generate_perf_tasks_10_thread
473479
commands:
474480
- func: clone
481+
- func: switch_context
475482
- func: generate_perf_tests_tasks
476483
vars:
477484
variant: e2e_operator_perf
@@ -480,6 +487,7 @@ tasks:
480487
- name: generate_perf_tasks_30_thread
481488
commands:
482489
- func: clone
490+
- func: switch_context
483491
- func: generate_perf_tests_tasks
484492
vars:
485493
variant: e2e_operator_perf_thirty
@@ -488,6 +496,7 @@ tasks:
488496
- name: build_om_images
489497
commands:
490498
- func: clone
499+
- func: switch_context
491500
- func: setup_building_host
492501
- func: pipeline
493502
vars:
@@ -496,6 +505,7 @@ tasks:
496505
- name: publish_ops_manager
497506
commands:
498507
- func: clone
508+
- func: switch_context
499509
- func: setup_building_host
500510
- func: quay_login
501511
- func: setup_docker_sbom

scripts/dev/contexts/init_release_agents_on_ecr

Lines changed: 0 additions & 10 deletions
This file was deleted.

scripts/dev/contexts/init_test_run

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/dev/contexts/init_test_run_ibm

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/dev/contexts/init_tests_with_olm

Lines changed: 0 additions & 9 deletions
This file was deleted.

scripts/dev/contexts/migrate_all_agents

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/dev/contexts/preflight_release_images

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)