From dda39623beb942cf590913554d7983e69e235f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Tue, 16 Sep 2025 10:17:48 +0200 Subject: [PATCH 01/21] CLOUDP-295785 - staging support for image building --- .evergreen-functions.yml | 51 ++++++--- .evergreen-release.yml | 23 ++-- .evergreen.yml | 85 ++++++--------- EVERGREEN.md | 43 ++++++++ Makefile | 30 +++--- build_info.json | 10 +- .../tests/clusterwideoperator/om_multiple.py | 2 - ...lm_meko_operator_upgrade_with_resources.py | 2 - .../olm_operator_upgrade_with_resources.py | 6 +- mongodb-community-operator/scripts/dev/e2e.py | 10 +- .../test/e2e/setup/test_config.go | 6 +- scripts/dev/contexts/e2e_mdb_kind_ubi_cloudqa | 2 +- scripts/dev/contexts/e2e_smoke | 41 +------ scripts/dev/contexts/e2e_smoke_arm | 2 +- scripts/dev/contexts/e2e_smoke_ibm_power | 3 +- scripts/dev/contexts/e2e_smoke_ibm_z | 3 +- .../contexts/e2e_static_mdb_kind_ubi_cloudqa | 2 +- scripts/dev/contexts/e2e_static_smoke | 41 +------ scripts/dev/contexts/e2e_static_smoke_arm | 3 +- .../dev/contexts/e2e_static_smoke_ibm_power | 4 +- scripts/dev/contexts/e2e_static_smoke_ibm_z | 4 +- scripts/dev/contexts/evg-private-context | 75 ++++++++----- scripts/dev/contexts/gha-private-context | 2 +- scripts/dev/contexts/local-defaults-context | 24 +---- .../contexts/prerelease_kind_code_snippets | 2 + scripts/dev/contexts/private-context-template | 2 +- .../dev/contexts/public_kind_code_snippets | 2 + scripts/dev/contexts/root-context | 62 +++++++---- scripts/dev/contexts/variables/e2e_smoke_base | 7 ++ scripts/dev/contexts/variables/om60 | 2 +- scripts/dev/contexts/variables/om60_image | 4 +- scripts/dev/contexts/variables/om70 | 2 +- scripts/dev/contexts/variables/om70_image | 4 +- scripts/dev/contexts/variables/om80 | 2 +- scripts/dev/contexts/variables/om80_image | 6 +- .../templates/mongodb-enterprise-tests.yaml | 4 +- .../deployments/test-app/values.yaml | 4 +- .../evergreen/e2e/build_tests_image_ibm.sh | 6 +- scripts/evergreen/e2e/single_e2e.sh | 18 ++-- .../prepare-openshift-bundles-for-e2e.sh | 21 ++-- scripts/funcs/operator_deployment | 16 +-- scripts/release/atomic_pipeline.py | 9 +- scripts/release/build/build_info.py | 38 +------ scripts/release/build/build_scenario.py | 60 ----------- scripts/release/constants.py | 59 ----------- .../release/{pipeline_main.py => pipeline.py} | 23 ++-- scripts/release/pipeline.sh | 7 ++ scripts/release/pipeline_agent.sh | 15 +++ scripts/release/pipeline_migrate_agent.sh | 8 -- scripts/release/pipeline_ops_manager.sh | 9 ++ scripts/release/pipeline_readiness_probe.sh | 9 ++ .../release/pipeline_version_upgrade_hook.sh | 9 ++ scripts/release/release_info.py | 67 ++---------- scripts/release/retag_images_to_staging.sh | 97 +++++++++++++++++ .../{ => tests}/atomic_pipeline_test.py | 0 scripts/release/tests/build_info_test.py | 100 +++--------------- scripts/release/tests/build_scenario_test.py | 39 ------- scripts/release/tests/conftest.py | 20 ---- scripts/release/tests/release_info_test.py | 35 +++--- 59 files changed, 509 insertions(+), 733 deletions(-) create mode 100644 EVERGREEN.md create mode 100644 scripts/dev/contexts/variables/e2e_smoke_base rename scripts/release/{pipeline_main.py => pipeline.py} (88%) create mode 100755 scripts/release/pipeline.sh create mode 100755 scripts/release/pipeline_agent.sh delete mode 100755 scripts/release/pipeline_migrate_agent.sh create mode 100755 scripts/release/pipeline_ops_manager.sh create mode 100755 scripts/release/pipeline_readiness_probe.sh create mode 100755 scripts/release/pipeline_version_upgrade_hook.sh create mode 100755 scripts/release/retag_images_to_staging.sh rename scripts/release/{ => tests}/atomic_pipeline_test.py (100%) delete mode 100644 scripts/release/tests/build_scenario_test.py diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index 70f11d368..64e77bd30 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -45,7 +45,8 @@ variables: - community_private_preview_pullsecret_dockerconfigjson - RELEASE_INITIAL_VERSION - RELEASE_INITIAL_COMMIT_SHA - - RELEASE_OPERATOR_VERSION + - OPERATOR_VERSION + - BUILD_SCENARIO functions: @@ -509,24 +510,48 @@ functions: params: shell: bash working_dir: src/github.com/mongodb/mongodb-kubernetes - include_expansions_in_env: - - version_id add_to_path: - ${workdir}/bin binary: scripts/evergreen/e2e/build_tests_image_ibm.sh - pipeline_migrate_agents: + pipeline: - *switch_context - command: subprocess.exec - retry_on_failure: false + 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_migrate_agent.sh + binary: scripts/release/pipeline.sh + env: + IMAGE_NAME: ${IMAGE_NAME} - pipeline: + pipeline_agent: + - *switch_context + - 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: + - *switch_context + - 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: - *switch_context - command: subprocess.exec retry_on_failure: true @@ -535,10 +560,9 @@ functions: shell: bash <<: *e2e_include_expansions_in_env working_dir: src/github.com/mongodb/mongodb-kubernetes - binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name} ${all_agents} ${build_scenario} + binary: scripts/release/pipeline_readiness_probe.sh - # TODO: this function is very similar to pipeline and it will joined with it in the future - release_operator_pipeline: + pipeline_version_upgrade_hook: - *switch_context - command: subprocess.exec retry_on_failure: true @@ -547,8 +571,7 @@ functions: shell: bash <<: *e2e_include_expansions_in_env working_dir: src/github.com/mongodb/mongodb-kubernetes - # By default, use the git tag that triggered the task which can be overridden with RELEASE_OPERATOR_VERSION - binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py ${image_name} --build-scenario release --version ${RELEASE_OPERATOR_VERSION|*triggered_by_git_tag} + binary: scripts/release/pipeline_version_upgrade_hook.sh teardown_cloud_qa_all: - *switch_context @@ -852,7 +875,7 @@ functions: - macos_notary_secret - workdir - triggered_by_git_tag - - RELEASE_OPERATOR_VERSION + - OPERATOR_VERSION env: XDG_CONFIG_HOME: ${go_base_path}${workdir} GO111MODULE: "on" @@ -862,7 +885,7 @@ functions: # 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=${RELEASE_OPERATOR_VERSION|*triggered_by_git_tag} + export GORELEASER_CURRENT_TAG=${OPERATOR_VERSION|*triggered_by_git_tag} export PATH=$GOROOT/bin:$PATH export GITHUB_TOKEN=${generated_token} ${workdir}/goreleaser release --clean diff --git a/.evergreen-release.yml b/.evergreen-release.yml index 8306a7ec9..4010c3240 100644 --- a/.evergreen-release.yml +++ b/.evergreen-release.yml @@ -12,8 +12,7 @@ tasks: - func: build_multi_cluster_binary - func: pipeline vars: - image_name: meko-tests - build_scenario: --build-scenario patch + IMAGE_NAME: meko-tests - name: release_operator tags: [ "image_release" ] @@ -22,9 +21,9 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: release_operator_pipeline + - func: pipeline vars: - image_name: operator + IMAGE_NAME: operator # Releases init images to Quay - name: release_init_appdb @@ -34,9 +33,9 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: release_operator_pipeline + - func: pipeline vars: - image_name: init-appdb + IMAGE_NAME: init-appdb - name: release_init_database tags: [ "image_release" ] @@ -45,9 +44,9 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: release_operator_pipeline + - func: pipeline vars: - image_name: init-database + IMAGE_NAME: init-database - name: release_init_ops_manager tags: [ "image_release" ] @@ -56,9 +55,9 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: release_operator_pipeline + - func: pipeline vars: - image_name: init-ops-manager + IMAGE_NAME: init-ops-manager - name: release_database tags: [ "image_release" ] @@ -67,9 +66,9 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: release_operator_pipeline + - func: pipeline vars: - image_name: database + IMAGE_NAME: database - name: prepare_and_upload_openshift_bundles tags: [ "openshift_bundles" ] diff --git a/.evergreen.yml b/.evergreen.yml index bb9d4eeec..199f66591 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -1,3 +1,5 @@ +# For .evergreen.yml configuration and usage reference, see EVERGREEN.md file + # 2h timeout for all the tasks exec_timeout_secs: 7200 @@ -61,7 +63,7 @@ variables: variant: init_test_run - name: build_readiness_probe_image variant: init_test_run - - name: build_upgrade_hook_image + - name: build_version_upgrade_hook_image variant: init_test_run - name: build_mco_test_image variant: init_test_run @@ -190,20 +192,6 @@ parameters: value: "false" description: set this to true if you would like the pipeline to automatically push a branch with updated snippets outputs -# Each variant needs to be tagged with one or more tags referencing related build scenario: -# - pr_patch: for patches created by GitHub PRs -# - staging: for builds triggered when merging to master or release branch -# - release: for builds triggered on git tags -# For variants that are **only** triggered manually (patch) or by PCT we should use "manual_patch" tag. -# Examples: `migrate_all_agents`, `e2e_operator_perf` or `publish_om80_images`. -# -# This configuration allows us to run all the associated tasks for each scenario from evergreen command line. -# This is especially helpful when making changes to `staging` or `release` variants and testing them using Evergreen -# command line patches. For example there is no other way to trigger tasks that are run on merges to master other than -# combining them together using aliases. The same applies for tasks being run on git tags. -# -# See https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Project-and-Distro-Settings#project-aliases - # Triggered manually or by PCT. patch_aliases: - alias: "periodic_teardowns" @@ -287,10 +275,9 @@ tasks: - func: setup_building_host - func: quay_login - func: setup_docker_sbom - - func: pipeline + - func: pipeline_agent vars: - image_name: agent - build_scenario: --build-scenario manual_release + BUILD_SCENARIO: manual_release - name: migrate_all_agents # this enables us to run this variant manually to build all the agents for the new registry @@ -299,7 +286,10 @@ tasks: - func: clone - func: setup_building_host - func: quay_login - - func: pipeline_migrate_agents + - func: pipeline_agent + vars: + BUILD_SCENARIO: manual_release + FLAGS: "--all-agents -r quay.io/mongodb/mongodb-agent" - name: run_precommit_and_push tags: [ "patch-run" ] @@ -326,10 +316,9 @@ tasks: commands: - func: clone - func: setup_building_host - - func: pipeline + - func: pipeline_agent vars: - image_name: agent - all_agents: "--all-agents" + FLAGS: "--all-agents" - name: release_all_currently_used_agents_on_ecr # this enables us to run this manually (patch) and release all agent versions to ECR to verify @@ -338,10 +327,9 @@ tasks: commands: - func: clone - func: setup_building_host - - func: pipeline + - func: pipeline_agent vars: - image_name: agent - all_agents: "--current-agents" + FLAGS: "--current-agents" - name: build_test_image commands: @@ -350,7 +338,7 @@ tasks: - func: build_multi_cluster_binary - func: pipeline vars: - image_name: meko-tests + IMAGE_NAME: meko-tests - name: build_test_image_ibm commands: @@ -373,7 +361,7 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: mco-tests + IMAGE_NAME: mco-tests - name: build_operator_ubi commands: @@ -381,7 +369,7 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: operator + IMAGE_NAME: operator - name: build_operator_race_ubi commands: @@ -389,7 +377,7 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: operator-race + IMAGE_NAME: operator-race - name: build_init_om_images_ubi commands: @@ -397,7 +385,7 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: init-ops-manager + IMAGE_NAME: init-ops-manager - name: build_init_appdb_images_ubi commands: @@ -405,15 +393,15 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: init-appdb + IMAGE_NAME: init-appdb - name: build_agent_images_ubi commands: - func: clone - func: setup_building_host - - func: pipeline + - func: pipeline_agent vars: - image_name: agent + FLAGS: "--current-agents" - name: build_init_database_image_ubi commands: @@ -421,7 +409,7 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: init-database + IMAGE_NAME: init-database - name: build_database_image_ubi commands: @@ -429,23 +417,19 @@ tasks: - func: setup_building_host - func: pipeline vars: - image_name: database + IMAGE_NAME: database - name: build_readiness_probe_image commands: - func: clone - func: setup_building_host - - func: pipeline - vars: - image_name: readiness-probe + - func: pipeline_readiness_probe - - name: build_upgrade_hook_image + - name: build_version_upgrade_hook_image commands: - func: clone - func: setup_building_host - - func: pipeline - vars: - image_name: upgrade-hook + - func: pipeline_version_upgrade_hook - name: prepare_aws priority: 59 @@ -488,9 +472,7 @@ tasks: commands: - func: clone - func: setup_building_host - - func: pipeline - vars: - image_name: ops-manager + - func: pipeline_ops_manager - name: publish_ops_manager commands: @@ -498,10 +480,9 @@ tasks: - func: setup_building_host - func: quay_login - func: setup_docker_sbom - - func: pipeline + - func: pipeline_ops_manager vars: - image_name: ops-manager - build_scenario: --build-scenario manual_release + BUILD_SCENARIO: manual_release - name: prepare_and_upload_openshift_bundles_for_e2e commands: @@ -579,7 +560,7 @@ task_groups: - e2e_search_external_basic - e2e_search_external_tls - # This is the task group that contains all the tests run in the e2e_mdb_kind_ubuntu_cloudqa build variant + # This is the task group that contains all the tests run in the e2e_mdb_kind_ubi_cloudqa build variant - name: e2e_mdb_kind_cloudqa_task_group max_hosts: -1 <<: *setup_group @@ -1173,7 +1154,7 @@ buildvariants: # e2e___[_] # where is any of mdb|om|operator # where is any of kind|openshift - # where is any of ubuntu|ubi + # where is only ubi # where denotes the OM version tested (e.g. om50, om60, cloudqa) - used only for MDB tests # MongoDBCommunity build variant @@ -1452,7 +1433,7 @@ buildvariants: - name: e2e_smoke_arm_task_group - name: e2e_static_smoke_arm - display_name: e2e_smoke_arm + display_name: e2e_static_smoke_arm tags: [ "staging", "e2e_smoke_test_suite", "static" ] run_on: - ubuntu2404-arm64-large @@ -1660,7 +1641,7 @@ buildvariants: - name: build_database_image_ubi - name: build_agent_images_ubi - name: build_readiness_probe_image - - name: build_upgrade_hook_image + - name: build_version_upgrade_hook_image - name: prepare_aws - name: init_test_run_ibm_power diff --git a/EVERGREEN.md b/EVERGREEN.md new file mode 100644 index 000000000..ac3aa18ff --- /dev/null +++ b/EVERGREEN.md @@ -0,0 +1,43 @@ +# Evergreen CI/CD Configuration Guide + +Each variant needs to be tagged with one or more tags referencing related build scenario: + - pr_patch: for patches created by GitHub PRs + - staging: for builds triggered when merging to master or release branch + - release: for builds triggered on git tags + +For variants that are **only** triggered manually (patch) or by PCT we should use "manual_patch" tag. +Examples: `migrate_all_agents`, `e2e_operator_perf` or `publish_om80_images`. + +This configuration allows us to run all the associated tasks for each scenario from evergreen command line. +This is especially helpful when making changes to `staging` or `release` variants and testing them using Evergreen +command line patches. For example there is no other way to trigger tasks that are run on merges to master other than +combining them together using aliases. The same applies for tasks being run on git tags. + +See https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Project-and-Distro-Settings#project-aliases + +# Running Evergreen build scenarios + +Use `BUILD_SCENARIO` parameter to select the build scenario you want to run. Based on the scenario selected the +appropriate `REGISTRY` and `OPERATOR_VERSION` values will be selected. `REGISTRY` and `OPERATOR_VERSION` can be +individually overridden as well. Overriding `OPERATOR_VERSION` is mostly applicable for `release` scenario, where +there is no git tag to pick up. + +## Example commands + +### Full patch scenario: + +```shell +evergreen patch -p mongodb-kubernetes -a pr_patch -d "Test PR patch build" -f -y -u --path .evergreen.yml +``` + +### Staging scenario: + +```shell +evergreen patch -p mongodb-kubernetes -a staging -d "Test staging build" -f -y -u --path .evergreen.yml --param BUILD_SCENARIO=staging +``` + +### Release scenario: + +```shell +evergreen patch -p mongodb-kubernetes -a release -d "Test release build" -f -y -u --path .evergreen.yml --param BUILD_SCENARIO=release --param OPERATOR_VERSION=1.3.0-rc +``` diff --git a/Makefile b/Makefile index 77f866d2b..53cfd94b6 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ usage: @ echo " full: ('make' is an alias for this command) ensures K8s cluster is up, cleans Kubernetes" @ echo " resources, build-push-deploy operator, push-deploy database, create secrets, " @ echo " config map, resources etc" - @ echo " appdb: build and push AppDB image. Specify 'om_version' in format '4.2.1' to provide the already released Ops Manager" + @ echo " appdb: build and push AppDB image. Specify 'OM_VERSION' in format '4.2.1' to provide the already released Ops Manager" @ echo " version which will be used to find the matching tag and find the Automation Agent version. Add 'om_branch' " @ echo " if Ops Manager is not released yet and you want to have some git branch as the source " @ echo " parameters in ~/operator-dev/om" @@ -75,13 +75,13 @@ operator: configure-operator build-and-push-operator-image # build-push, (todo) restart database database: aws_login - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py database + @ scripts/dev/run_python.sh scripts/release/pipeline.py database readiness_probe: aws_login - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py readiness-probe + @ scripts/dev/run_python.sh scripts/release/pipeline.py readiness-probe upgrade_hook: aws_login - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py upgrade-hook + @ scripts/dev/run_python.sh scripts/release/pipeline.py upgrade-hook # ensures cluster is up, cleans Kubernetes + OM, build-push-deploy operator, # push-deploy database, create secrets, config map, resources etc @@ -90,7 +90,7 @@ full: build-and-push-images # build-push appdb image appdb: aws_login - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py --include appdb + @ scripts/dev/run_python.sh scripts/release/pipeline.py --include appdb # runs the e2e test: make e2e test=e2e_sharded_cluster_pv. The Operator is redeployed before the test, the namespace is cleaned. # The e2e test image is built and pushed together with all main ones (operator, database, init containers) @@ -154,19 +154,19 @@ aws_cleanup: @ scripts/evergreen/prepare_aws.sh build-and-push-operator-image: aws_login - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py operator + @ scripts/dev/run_python.sh scripts/release/pipeline.py operator build-and-push-database-image: aws_login @ scripts/dev/build_push_database_image build-and-push-test-image: aws_login build-multi-cluster-binary @ if [[ -z "$(local)" ]]; then \ - scripts/dev/run_python.sh scripts/release/pipeline_main.py test; \ + scripts/dev/run_python.sh scripts/release/pipeline.py test; \ fi build-and-push-mco-test-image: aws_login @ if [[ -z "$(local)" ]]; then \ - scripts/dev/run_python.sh scripts/release/pipeline_main.py mco-test; \ + scripts/dev/run_python.sh scripts/release/pipeline.py mco-test; \ fi build-multi-cluster-binary: @@ -181,27 +181,27 @@ build-and-push-images: build-and-push-operator-image appdb-init-image om-init-im build-and-push-init-images: appdb-init-image om-init-image database-init-image database-init-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py init-database + @ scripts/dev/run_python.sh scripts/release/pipeline.py init-database appdb-init-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py init-appdb + @ scripts/dev/run_python.sh scripts/release/pipeline.py init-appdb # Not setting a parallel-factor will default to 0 which will lead to using all CPUs, that can cause docker to die. # Here we are defaulting to 6, a higher value might work for you. agent-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel --parallel-factor 6 agent + @ scripts/dev/run_python.sh scripts/release/pipeline.py --parallel --parallel-factor 6 agent agent-image-slow: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel-factor 1 agent + @ scripts/dev/run_python.sh scripts/release/pipeline.py --parallel-factor 1 agent operator-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py operator + @ scripts/dev/run_python.sh scripts/release/pipeline.py operator om-init-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py init-ops-manager + @ scripts/dev/run_python.sh scripts/release/pipeline.py init-ops-manager om-image: - @ scripts/dev/run_python.sh scripts/release/pipeline_main.py ops-manager + @ scripts/dev/run_python.sh scripts/release/pipeline.py ops-manager configure-operator: @ scripts/dev/configure_operator.sh diff --git a/build_info.json b/build_info.json index f7f903f7e..b85686891 100644 --- a/build_info.json +++ b/build_info.json @@ -178,6 +178,12 @@ "linux/arm64", "linux/amd64" ] + }, + "release": { + "repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], + "platforms": [ + "linux/amd64" + ] } }, "mco-tests": { @@ -213,7 +219,6 @@ ] }, "release": { - "version": "1.0.22", "sign": true, "olm-tag": true, "repositories": [ @@ -243,7 +248,6 @@ ] }, "release": { - "version": "1.0.9", "sign": true, "olm-tag": true, "repositories": ["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], @@ -286,14 +290,12 @@ "ops-manager": { "dockerfile-path": "docker/mongodb-enterprise-ops-manager/Dockerfile", "patch": { - "version": "om-version-from-release.json", "repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-enterprise-ops-manager-ubi"], "platforms": [ "linux/amd64" ] }, "staging": { - "version": "om-version-from-release.json", "sign": true, "repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-enterprise-ops-manager-ubi"], "platforms": [ diff --git a/docker/mongodb-kubernetes-tests/tests/clusterwideoperator/om_multiple.py b/docker/mongodb-kubernetes-tests/tests/clusterwideoperator/om_multiple.py index f58910e71..4ef6401d1 100644 --- a/docker/mongodb-kubernetes-tests/tests/clusterwideoperator/om_multiple.py +++ b/docker/mongodb-kubernetes-tests/tests/clusterwideoperator/om_multiple.py @@ -13,13 +13,11 @@ from tests.conftest import ( get_central_cluster_client, get_evergreen_task_id, - get_member_cluster_api_client, get_member_cluster_clients, get_multi_cluster_operator_clustermode, get_multi_cluster_operator_installation_config, get_operator_clusterwide, get_operator_installation_config, - get_version_id, is_multi_cluster, ) from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment diff --git a/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py b/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py index 6adc8ade5..a9e7bc5c3 100644 --- a/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py +++ b/docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py @@ -123,7 +123,6 @@ def latest_released_meko_version(): @pytest.mark.e2e_olm_meko_operator_upgrade_with_resources def test_meko_install_stable_operator_version( namespace: str, - version_id: str, latest_released_meko_version: str, catalog_source: CustomObject, meko_subscription: CustomObject, @@ -464,7 +463,6 @@ def test_connectivity_after_meko_uninstall( @pytest.mark.e2e_olm_meko_operator_upgrade_with_resources def test_install_mck_operator( namespace: str, - version_id: str, catalog_source: CustomObject, ): current_operator_version = get_current_operator_version() diff --git a/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py b/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py index f0aafacf5..70373e5f7 100644 --- a/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py +++ b/docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py @@ -87,7 +87,6 @@ def current_operator_version(): @pytest.mark.e2e_olm_operator_upgrade_with_resources def test_install_stable_operator_version( namespace: str, - version_id: str, current_operator_version: str, catalog_source: CustomObject, subscription: CustomObject, @@ -338,7 +337,6 @@ def test_resources_in_running_state_before_upgrade( @pytest.mark.e2e_olm_operator_upgrade_with_resources def test_operator_upgrade_to_fast( namespace: str, - version_id: str, catalog_source: CustomObject, subscription: CustomObject, ): @@ -356,8 +354,8 @@ def update_subscription() -> bool: except kubernetes.client.ApiException as e: if e.status == 409: return False - else: - raise e + else: + raise e run_periodically(update_subscription, timeout=100, msg="Subscription to be updated") diff --git a/mongodb-community-operator/scripts/dev/e2e.py b/mongodb-community-operator/scripts/dev/e2e.py index 137f946fd..a3c585649 100755 --- a/mongodb-community-operator/scripts/dev/e2e.py +++ b/mongodb-community-operator/scripts/dev/e2e.py @@ -81,7 +81,7 @@ def create_test_pod(args: argparse.Namespace, namespace: str) -> None: "containers": [ { "name": TEST_POD_NAME, - "image": f"{os.getenv('BASE_REPO_URL')}/mongodb-community-tests:{os.getenv('VERSION_ID')}", + "image": f"{os.getenv('REGISTRY')}/mongodb-community-tests:{os.getenv('OPERATOR_VERSION')}", "imagePullPolicy": "Always", "env": [ { @@ -89,12 +89,12 @@ def create_test_pod(args: argparse.Namespace, namespace: str) -> None: "value": f"{args.cluster_wide}", }, { - "name": "VERSION_ID", - "value": f"{os.getenv('VERSION_ID')}", + "name": "OPERATOR_VERSION", + "value": f"{os.getenv('OPERATOR_VERSION')}", }, { - "name": "BASE_REPO_URL", - "value": f"{os.getenv('BASE_REPO_URL')}", + "name": "OPERATOR_REGISTRY", + "value": f"{os.getenv('OPERATOR_REGISTRY')}", }, { "name": "MDB_COMMUNITY_AGENT_IMAGE", diff --git a/mongodb-community-operator/test/e2e/setup/test_config.go b/mongodb-community-operator/test/e2e/setup/test_config.go index 399155a12..9cd526d34 100644 --- a/mongodb-community-operator/test/e2e/setup/test_config.go +++ b/mongodb-community-operator/test/e2e/setup/test_config.go @@ -9,11 +9,11 @@ const ( testNamespaceEnvName = "WATCH_NAMESPACE" testCertManagerNamespaceEnvName = "TEST_CERT_MANAGER_NAMESPACE" testCertManagerVersionEnvName = "TEST_CERT_MANAGER_VERSION" - operatorImageRepoEnvName = "BASE_REPO_URL" + operatorImageRepoEnvName = "OPERATOR_REGISTRY" clusterWideEnvName = "CLUSTER_WIDE" performCleanupEnvName = "PERFORM_CLEANUP" LocalOperatorEnvName = "LOCAL_OPERATOR" - versionIdEnv = "VERSION_ID" + operatorVersionEnvName = "OPERATOR_VERSION" ) type TestConfig struct { @@ -39,7 +39,7 @@ func LoadTestConfigFromEnv() TestConfig { OperatorImage: "mongodb-kubernetes", Namespace: envvar.GetEnvOrDefault(testNamespaceEnvName, "mongodb-test"), // nolint:forbidigo // The operator version is based on the versionID, which context sets either locally manually or evg per patch - OperatorVersion: envvar.GetEnvOrDefault(versionIdEnv, ""), // nolint:forbidigo + OperatorVersion: envvar.GetEnvOrDefault(operatorVersionEnvName, ""), // nolint:forbidigo CertManagerNamespace: envvar.GetEnvOrDefault(testCertManagerNamespaceEnvName, "cert-manager"), // nolint:forbidigo CertManagerVersion: envvar.GetEnvOrDefault(testCertManagerVersionEnvName, "v1.5.3"), // nolint:forbidigo OperatorImageRepoUrl: envvar.GetEnvOrDefault(operatorImageRepoEnvName, "quay.io/mongodb"), // nolint:forbidigo diff --git a/scripts/dev/contexts/e2e_mdb_kind_ubi_cloudqa b/scripts/dev/contexts/e2e_mdb_kind_ubi_cloudqa index 886ecb8be..21282094b 100644 --- a/scripts/dev/contexts/e2e_mdb_kind_ubi_cloudqa +++ b/scripts/dev/contexts/e2e_mdb_kind_ubi_cloudqa @@ -10,7 +10,7 @@ source "${script_dir}/root-context" export ops_manager_version="cloud_qa" # This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY="${BASE_REPO_URL}" +export OPS_MANAGER_REGISTRY="${REGISTRY}" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION diff --git a/scripts/dev/contexts/e2e_smoke b/scripts/dev/contexts/e2e_smoke index d34badad6..fa5265f5f 100644 --- a/scripts/dev/contexts/e2e_smoke +++ b/scripts/dev/contexts/e2e_smoke @@ -6,44 +6,5 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/om70" - -export DATABASE_REGISTRY="${QUAY_REGISTRY}" -export INIT_OPS_MANAGER_REGISTRY="${QUAY_REGISTRY}" -export OPS_MANAGER_REGISTRY="${QUAY_REGISTRY}" -export OPERATOR_REGISTRY="${QUAY_REGISTRY}" -export INIT_IMAGES_REGISTRY="${QUAY_REGISTRY}" -export INIT_APPDB_REGISTRY="${QUAY_REGISTRY}" -export INIT_DATABASE_REGISTRY="${QUAY_REGISTRY}" -# Since we're sourcing this as an initial step, the jq might not be there. That's why we need bash magic here. -# TODO: provide version overrides from the root-context based on the scenario -# https://docs.google.com/document/d/1eJ8iKsI0libbpcJakGjxcPfbrTn8lmcZDbQH1UqMR_g/edit?tab=t.p76ry15gwmkk#bookmark=id.j8iox5gg46rp -OPERATOR_VERSION="$(grep -o '"mongodbOperator": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - OPERATOR_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export OPERATOR_VERSION - -INIT_DATABASE_VERSION="$(grep -o '"initDatabaseVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_DATABASE_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_DATABASE_VERSION - -INIT_APPDB_VERSION="$(grep -o '"initAppDbVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_APPDB_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_APPDB_VERSION - -INIT_OPS_MANAGER_VERSION="$(grep -o '"initOpsManagerVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_OPS_MANAGER_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_OPS_MANAGER_VERSION - -DATABASE_VERSION="$(grep -o '"databaseImageVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - DATABASE_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export DATABASE_VERSION diff --git a/scripts/dev/contexts/e2e_smoke_arm b/scripts/dev/contexts/e2e_smoke_arm index f23426d9b..a91df4ad8 100644 --- a/scripts/dev/contexts/e2e_smoke_arm +++ b/scripts/dev/contexts/e2e_smoke_arm @@ -6,10 +6,10 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" export ops_manager_version="cloud_qa" - export CUSTOM_MDB_VERSION=8.0.12-ent export KUBE_ENVIRONMENT_NAME=kind export CLUSTER_TYPE=kind diff --git a/scripts/dev/contexts/e2e_smoke_ibm_power b/scripts/dev/contexts/e2e_smoke_ibm_power index 77c1cf549..4c1728a43 100644 --- a/scripts/dev/contexts/e2e_smoke_ibm_power +++ b/scripts/dev/contexts/e2e_smoke_ibm_power @@ -6,9 +6,8 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" -# This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION diff --git a/scripts/dev/contexts/e2e_smoke_ibm_z b/scripts/dev/contexts/e2e_smoke_ibm_z index 77c1cf549..4c1728a43 100644 --- a/scripts/dev/contexts/e2e_smoke_ibm_z +++ b/scripts/dev/contexts/e2e_smoke_ibm_z @@ -6,9 +6,8 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" -# This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION diff --git a/scripts/dev/contexts/e2e_static_mdb_kind_ubi_cloudqa b/scripts/dev/contexts/e2e_static_mdb_kind_ubi_cloudqa index f4fe1ebdb..5fecbae6d 100644 --- a/scripts/dev/contexts/e2e_static_mdb_kind_ubi_cloudqa +++ b/scripts/dev/contexts/e2e_static_mdb_kind_ubi_cloudqa @@ -11,7 +11,7 @@ export ops_manager_version="cloud_qa" export MDB_DEFAULT_ARCHITECTURE=static # This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY="${BASE_REPO_URL}" +export OPS_MANAGER_REGISTRY="${REGISTRY}" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION diff --git a/scripts/dev/contexts/e2e_static_smoke b/scripts/dev/contexts/e2e_static_smoke index baae4ce10..ca5e4a0f4 100644 --- a/scripts/dev/contexts/e2e_static_smoke +++ b/scripts/dev/contexts/e2e_static_smoke @@ -6,48 +6,9 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/om70" -export DATABASE_REGISTRY="${QUAY_REGISTRY}" -export INIT_OPS_MANAGER_REGISTRY="${QUAY_REGISTRY}" -export OPS_MANAGER_REGISTRY="${QUAY_REGISTRY}" -export OPERATOR_REGISTRY="${QUAY_REGISTRY}" -export INIT_IMAGES_REGISTRY="${QUAY_REGISTRY}" -export INIT_APPDB_REGISTRY="${QUAY_REGISTRY}" -export INIT_DATABASE_REGISTRY="${QUAY_REGISTRY}" -# Since we're sourcing this as an initial step, the jq might not be there. That's why we need bash magic here. -# TODO: provide version overrides from the root-context based on the scenario -# https://docs.google.com/document/d/1eJ8iKsI0libbpcJakGjxcPfbrTn8lmcZDbQH1UqMR_g/edit?tab=t.p76ry15gwmkk#bookmark=id.j8iox5gg46rp -OPERATOR_VERSION="$(grep -o '"mongodbOperator": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - OPERATOR_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export OPERATOR_VERSION - -INIT_DATABASE_VERSION="$(grep -o '"initDatabaseVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_DATABASE_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_DATABASE_VERSION - -INIT_APPDB_VERSION="$(grep -o '"initAppDbVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_APPDB_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_APPDB_VERSION - -INIT_OPS_MANAGER_VERSION="$(grep -o '"initOpsManagerVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - INIT_OPS_MANAGER_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export INIT_OPS_MANAGER_VERSION - -DATABASE_VERSION="$(grep -o '"databaseImageVersion": "[^"]*' release.json | grep -o '[^"]*$')" -if [[ "${RELEASE_OPERATOR_VERSION:-}" != "" ]]; then - DATABASE_VERSION="${RELEASE_OPERATOR_VERSION}" -fi -export DATABASE_VERSION - export MDB_DEFAULT_ARCHITECTURE=static # For static smoke tests we need the previous MDB version to have a ubi9 binary export CUSTOM_MDB_PREV_VERSION=6.0.5 diff --git a/scripts/dev/contexts/e2e_static_smoke_arm b/scripts/dev/contexts/e2e_static_smoke_arm index 65f0c3dfe..da029d303 100644 --- a/scripts/dev/contexts/e2e_static_smoke_arm +++ b/scripts/dev/contexts/e2e_static_smoke_arm @@ -6,11 +6,10 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" export ops_manager_version="cloud_qa" -# This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION diff --git a/scripts/dev/contexts/e2e_static_smoke_ibm_power b/scripts/dev/contexts/e2e_static_smoke_ibm_power index d31b03fd0..a13040feb 100644 --- a/scripts/dev/contexts/e2e_static_smoke_ibm_power +++ b/scripts/dev/contexts/e2e_static_smoke_ibm_power @@ -6,12 +6,12 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" -# This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION + export MDB_DEFAULT_ARCHITECTURE=static # MDB supports ppc64le on RHEL9 only from 8.0.12 onwards export CUSTOM_MDB_VERSION=8.0.12-ent diff --git a/scripts/dev/contexts/e2e_static_smoke_ibm_z b/scripts/dev/contexts/e2e_static_smoke_ibm_z index aeaa8423d..394984430 100644 --- a/scripts/dev/contexts/e2e_static_smoke_ibm_z +++ b/scripts/dev/contexts/e2e_static_smoke_ibm_z @@ -6,12 +6,12 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" +source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" -# This is required to be able to rebuild the om image and use that image which has been rebuilt -export OPS_MANAGER_REGISTRY=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') export CUSTOM_OM_VERSION + export MDB_DEFAULT_ARCHITECTURE=static # MDB supports s390x on RHEL9 only from 8.0.12 onwards export CUSTOM_MDB_VERSION=8.0.12-ent diff --git a/scripts/dev/contexts/evg-private-context b/scripts/dev/contexts/evg-private-context index 1eb2ef0f5..93374a409 100644 --- a/scripts/dev/contexts/evg-private-context +++ b/scripts/dev/contexts/evg-private-context @@ -33,26 +33,6 @@ else fi export NAMESPACE -export BASE_REPO_URL="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" - -export REGISTRY="${BASE_REPO_URL}" -export QUAY_REGISTRY=quay.io/mongodb -export OPERATOR_REGISTRY=${REGISTRY} -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} -export INIT_APPDB_REGISTRY=${INIT_IMAGES_REGISTRY} -export INIT_OPS_MANAGER_REGISTRY=${INIT_IMAGES_REGISTRY-"${QUAY_REGISTRY}"} -export INIT_DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY:-"${QUAY_REGISTRY}"} -export DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY:-"${QUAY_REGISTRY}"} -export OPS_MANAGER_REGISTRY=${QUAY_REGISTRY} -export MONGODB_ENTERPRISE_DATABASE_IMAGE="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-database" -export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-database" -export MDB_AGENT_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-agent" - -# these are needed to deploy OM -export INIT_APPDB_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-appdb" -export OPS_MANAGER_IMAGE_REPOSITORY="${QUAY_REGISTRY}/mongodb-enterprise-ops-manager-ubi" -export INIT_OPS_MANAGER_IMAGE_REPOSITORY=${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-ops-manager - export CLUSTER_TYPE="kind" # Empty sting means that we're not using it. export EVG_HOST_NAME="" @@ -93,6 +73,8 @@ export IS_PATCH="${is_patch:-"unknown"}" export BUILD_ID="${build_id:-"unknown"}" export EXECUTION="${execution:-"unknown"}" export BUILD_VARIANT="${build_variant:-"unknown"}" +export VERSION_ID="${version_id:-"unknown"}" +export GIT_TAG="${triggered_by_git_tag:-}" # var used in pipeline.py to determine if we're running on EVG host # used to discern between local pipeline image build and the build in pipeline @@ -104,11 +86,6 @@ export DELETE_KIND_NETWORK="true" # it's also set explicitly in public_*_snippets variants export CODE_SNIPPETS_COMMIT_OUTPUT=${code_snippets_commit_output:-"false"} -# MCO -# shellcheck disable=SC2154 -export READINESS_PROBE_IMAGE="${BASE_REPO_URL}/mongodb-kubernetes-readinessprobe:${version_id}" -export VERSION_UPGRADE_HOOK_IMAGE="${BASE_REPO_URL}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${version_id}" - # shellcheck disable=SC2154 export PRERELEASE_PULLSECRET_DOCKERCONFIGJSON="${community_private_preview_pullsecret_dockerconfigjson}" @@ -121,3 +98,51 @@ export cognito_workload_url="${cognito_workload_url}" export cognito_workload_user_id="${cognito_workload_user_id}" export MDB_UPDATE_LICENSES=true + +# Set BUILD_SCENARIO based on evergreen variables +# BUILD_SCENARIO can be overridden externally if needed +BUILD_SCENARIO_RELEASE="release" # Official release triggered by a git tag +BUILD_SCENARIO_STAGING="staging" # CI build from a merge to the master +BUILD_SCENARIO_PATCH="patch" # CI build for a patch/pull request +if [ -n "${BUILD_SCENARIO-}" ]; then + echo "Build scenario has been set externally, not overriding it" +elif [ "${GIT_TAG}" ]; then + BUILD_SCENARIO=$BUILD_SCENARIO_RELEASE +elif [ "${IS_PATCH}" == "true" ]; then + BUILD_SCENARIO=$BUILD_SCENARIO_PATCH +else + BUILD_SCENARIO=$BUILD_SCENARIO_STAGING +fi +echo "Setting BUILD_SCENARIO=${BUILD_SCENARIO}" +export BUILD_SCENARIO="${BUILD_SCENARIO}" + +# Set REGISTRY and OPERATOR_VERSION based on build scenario +# REGISTRY and OPERATOR_VERSION can be overridden externally if needed +PATCH_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" +STAGING_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com/staging" +RELEASE_REGISTRY="quay.io/mongodb" +case $BUILD_SCENARIO in + "${BUILD_SCENARIO_RELEASE}") + REGISTRY="${REGISTRY:-$RELEASE_REGISTRY}" + OPERATOR_VERSION="${OPERATOR_VERSION:-$GIT_TAG}" + ;; + + "${BUILD_SCENARIO_STAGING}") + COMMIT_SHA_SHORT=$(git rev-parse --short=8 HEAD) + REGISTRY="${REGISTRY:-$STAGING_REGISTRY}" + OPERATOR_VERSION="${OPERATOR_VERSION:-$COMMIT_SHA_SHORT}" + ;; + + "${BUILD_SCENARIO_PATCH}") + REGISTRY="${REGISTRY:-$PATCH_REGISTRY}" + OPERATOR_VERSION="${OPERATOR_VERSION:-$VERSION_ID}" + ;; + + *) + echo "Unknown BUILD_SCENARIO=${BUILD_SCENARIO}, exiting" + exit 1 + ;; +esac +echo "Setting REGISTRY=${REGISTRY} and OPERATOR_VERSION=${OPERATOR_VERSION} for ${BUILD_SCENARIO} build scenario" +export OPERATOR_VERSION="${OPERATOR_VERSION}" +export REGISTRY="${REGISTRY}" diff --git a/scripts/dev/contexts/gha-private-context b/scripts/dev/contexts/gha-private-context index c5a189fb8..61770da79 100644 --- a/scripts/dev/contexts/gha-private-context +++ b/scripts/dev/contexts/gha-private-context @@ -5,4 +5,4 @@ set -Eeou pipefail export NAMESPACE="" export CLUSTER_NAME="" export LOCAL_OPERATOR="false" -export BASE_REPO_URL="" +export REGISTRY="" diff --git a/scripts/dev/contexts/local-defaults-context b/scripts/dev/contexts/local-defaults-context index e0c3b292c..485585f43 100644 --- a/scripts/dev/contexts/local-defaults-context +++ b/scripts/dev/contexts/local-defaults-context @@ -20,33 +20,13 @@ export workdir # The main registry to use for local test runs # - global: /dev is the shared registry # - dedicated: / -# Note: in our root-context we default the image tag to latest, if VERSION_ID is not preset on your machine +# Note: in our root-context we default the image tag to latest, if OPERATOR_VERSION is not preset on your machine # Note2: For quick local development defaults we only use shared images export QUAY_REGISTRY=quay.io/mongodb -export BASE_REPO_URL_SHARED="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" +export BASE_REPO_URL_SHARED="268558157000.dkr.ecr.us-east-1.amazonaws.com/staging" # Note: the Operator registry (OPERATOR_REGISTRY variable) is defined in the private context export REGISTRY="${BASE_REPO_URL_SHARED}" -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-"${REGISTRY}"} - -export INIT_APPDB_REGISTRY="${BASE_REPO_URL_SHARED}" -export INIT_OPS_MANAGER_REGISTRY=${BASE_REPO_URL_SHARED:-"${QUAY_REGISTRY}"} -export INIT_DATABASE_REGISTRY=${BASE_REPO_URL_SHARED:-"${QUAY_REGISTRY}"} -export INIT_DATABASE_IMAGE_REPOSITORY="${BASE_REPO_URL_SHARED}/mongodb-kubernetes-init-database" -export DATABASE_REGISTRY=${BASE_REPO_URL_SHARED:-"${QUAY_REGISTRY}"} -export OPS_MANAGER_REGISTRY="${QUAY_REGISTRY}" -export MONGODB_REPO_URL="${QUAY_REGISTRY}" -export MONGODB_ENTERPRISE_DATABASE_IMAGE="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-database" -export MDB_AGENT_IMAGE_OPERATOR_VERSION=latest -export MDB_AGENT_IMAGE_REPOSITORY="${BASE_REPO_URL_SHARED}/mongodb-agent" -export AGENT_BASE_REGISTRY=${BASE_REPO_URL_SHARED} -export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:12.0.35.7911-1" - -# these are needed to deploy OM -export INIT_APPDB_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-appdb" -export OPS_MANAGER_IMAGE_REPOSITORY="${QUAY_REGISTRY}/mongodb-enterprise-ops-manager-ubi" -export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-ops-manager" - # Environment variable needed for local development # Used in controllers/operator/mongodbopsmanager_controller.go # The file is created by scripts/dev/prepare_local_e2e_run.sh diff --git a/scripts/dev/contexts/prerelease_kind_code_snippets b/scripts/dev/contexts/prerelease_kind_code_snippets index 4248bb9ee..267f8fd8e 100644 --- a/scripts/dev/contexts/prerelease_kind_code_snippets +++ b/scripts/dev/contexts/prerelease_kind_code_snippets @@ -13,4 +13,6 @@ export NAMESPACE=mongodb export CODE_SNIPPETS_FLAVOR=e2e_prerelease export CODE_SNIPPETS_COMMIT_OUTPUT=true +export ops_manager_version="cloud_qa" + export PRERELEASE_IMAGE_PULLSECRET="${PRERELEASE_PULLSECRET_DOCKERCONFIGJSON}" diff --git a/scripts/dev/contexts/private-context-template b/scripts/dev/contexts/private-context-template index 2a95eaf42..ff49a1ab9 100644 --- a/scripts/dev/contexts/private-context-template +++ b/scripts/dev/contexts/private-context-template @@ -26,7 +26,7 @@ export EVG_HOST_NAME="" # - 268558157000.dkr.ecr.us-east-1.amazonaws.com/ export BASE_REPO_URL="268558157000.dkr.ecr.us-east-1.amazonaws.com/${USER}" # The operator image should -in general- be pulled from the user repository -# In certain case, the /dev repo can be used as well (BASE_REPO_URL_SHARED) +# In certain case, the /staging repo can be used as well (BASE_REPO_URL_SHARED) export OPERATOR_REGISTRY="${BASE_REPO_URL}" # Set to true if running operator locally and not in a pod diff --git a/scripts/dev/contexts/public_kind_code_snippets b/scripts/dev/contexts/public_kind_code_snippets index 83d816c43..047f1dd5a 100644 --- a/scripts/dev/contexts/public_kind_code_snippets +++ b/scripts/dev/contexts/public_kind_code_snippets @@ -12,3 +12,5 @@ source "${script_dir}/root-context" export NAMESPACE=mongodb export CODE_SNIPPETS_FLAVOR=e2e_public export CODE_SNIPPETS_COMMIT_OUTPUT=true + +export ops_manager_version="cloud_qa" diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index 300f84e30..d2a1bcc43 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -39,7 +39,6 @@ export OPERATOR_ENV=${OPERATOR_ENV:-"dev"} AGENT_VERSION="$(jq -r '.agentVersion' "${PROJECT_DIR}/release.json")" export AGENT_VERSION -export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" # Ops Manager export OPS_MANAGER_NAMESPACE="operator-testing-50-current" @@ -47,19 +46,48 @@ export OPS_MANAGER_NAMESPACE="operator-testing-50-current" # Moved from the old set_env_context.sh export LOCAL_RUN=true -# version_id is similar to version_id from Evergreen. Used to differentiate different builds. Can be constant -# for local run -version_id=${version_id:-"latest"} +OPERATOR_VERSION=${OPERATOR_VERSION:-"latest"} +READINESS_PROBE_VERSION=${READINESS_PROBE_VERSION:-"latest"} +VERSION_UPGRADE_HOOK_VERSION=${VERSION_UPGRADE_HOOK_VERSION:-"latest"} if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then - version_id="${OVERRIDE_VERSION_ID}" + OPERATOR_VERSION="${OVERRIDE_VERSION_ID}" + READINESS_PROBE_VERSION="${OVERRIDE_VERSION_ID}" + VERSION_UPGRADE_HOOK_VERSION="${OVERRIDE_VERSION_ID}" fi -export version_id -export VERSION_ID="${version_id}" -export INIT_APPDB_VERSION="${VERSION_ID}" -export INIT_DATABASE_VERSION="${VERSION_ID}" -export INIT_OPS_MANAGER_VERSION="${VERSION_ID}" -export DATABASE_VERSION="${VERSION_ID}" +export OPERATOR_VERSION="${OPERATOR_VERSION}" +export INIT_APPDB_VERSION="${OPERATOR_VERSION}" +export INIT_DATABASE_VERSION="${OPERATOR_VERSION}" +export INIT_OPS_MANAGER_VERSION="${OPERATOR_VERSION}" +export DATABASE_VERSION="${OPERATOR_VERSION}" +export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION}" + +### Registries and images +export QUAY_REGISTRY="quay.io/mongodb" +export OPERATOR_REGISTRY=${REGISTRY} +export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} + +# Specific registries for different images, can be overridden if needed +export INIT_APPDB_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_APPDB_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-appdb" +export INIT_OPS_MANAGER_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-ops-manager" +export INIT_DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-database" +export DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} +export MONGODB_ENTERPRISE_DATABASE_IMAGE="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-database" +export OPS_MANAGER_REGISTRY=${REGISTRY} +export OPS_MANAGER_IMAGE_REPOSITORY="${OPS_MANAGER_REGISTRY}/mongodb-enterprise-ops-manager-ubi" +export MDB_AGENT_REGISTRY=${REGISTRY} +export MDB_AGENT_IMAGE_REPOSITORY="${MDB_AGENT_REGISTRY}/mongodb-agent" +export MONGODB_REPO_URL="${QUAY_REGISTRY}" +export MEKO_TESTS_REGISTRY=${REGISTRY} +export MEKO_TESTS_IMAGE_REPOSITORY="${MEKO_TESTS_REGISTRY}/mongodb-kubernetes-tests" + +export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" +export READINESS_PROBE_IMAGE="${REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_IMAGE="${REGISTRY}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${VERSION_UPGRADE_HOOK_VERSION}" export KUBE_ENVIRONMENT_NAME=kind @@ -75,8 +103,6 @@ if [[ "$(uname)" == "Linux" ]]; then export GOROOT=/opt/golang/go1.24 fi -export MONGODB_REPO_URL="quay.io/mongodb" - export SIGNING_PUBLIC_KEY_URL="https://cosign.mongodb.com/mongodb-enterprise-kubernetes-operator.pem" export CLUSTER_DOMAIN="cluster.local" @@ -96,23 +122,13 @@ export OLM_VERSION=v0.31.0 # Python version we use locally and in CI export PYTHON_VERSION=3.13.7 - ## MCO - export MDB_COMMUNITY_IMAGE=mongodb-community-server export MDB_COMMUNITY_REPO_URL=quay.io/mongodb export MDB_COMMUNITY_AGENT_IMAGE=${AGENT_IMAGE} export MDB_COMMUNITY_IMAGE_TYPE=ubi8 -export READINESS_PROBE_IMAGE="${BASE_REPO_URL}/mongodb-kubernetes-readinessprobe:${version_id}" -export VERSION_UPGRADE_HOOK_IMAGE="${BASE_REPO_URL}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${version_id}" - # Community Search -export MDB_COMMUNITY_IMAGE=mongodb-community-server -export MDB_COMMUNITY_REPO_URL=quay.io/mongodb -export MDB_COMMUNITY_AGENT_IMAGE=${AGENT_IMAGE} -export MDB_COMMUNITY_IMAGE_TYPE=ubi8 - MDB_SEARCH_VERSION="$(jq -r '.search.version' "${PROJECT_DIR}/release.json")" export MDB_SEARCH_VERSION diff --git a/scripts/dev/contexts/variables/e2e_smoke_base b/scripts/dev/contexts/variables/e2e_smoke_base new file mode 100644 index 000000000..3111a1194 --- /dev/null +++ b/scripts/dev/contexts/variables/e2e_smoke_base @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +if [[ "${BUILD_SCENARIO}" == "release" ]]; then + export MEKO_TESTS_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" +fi diff --git a/scripts/dev/contexts/variables/om60 b/scripts/dev/contexts/variables/om60 index e2e77e3ab..7ab10f541 100644 --- a/scripts/dev/contexts/variables/om60 +++ b/scripts/dev/contexts/variables/om60 @@ -15,4 +15,4 @@ export CUSTOM_MDB_PREV_VERSION=5.0.7 export CUSTOM_APPDB_VERSION=6.0.21-ent export TEST_MODE=opsmanager -export OPS_MANAGER_REGISTRY="${BASE_REPO_URL}" +export OPS_MANAGER_REGISTRY="${REGISTRY}" diff --git a/scripts/dev/contexts/variables/om60_image b/scripts/dev/contexts/variables/om60_image index 1c4ee1ae6..7ca3a6e2a 100644 --- a/scripts/dev/contexts/variables/om60_image +++ b/scripts/dev/contexts/variables/om60_image @@ -5,5 +5,5 @@ set -Eeou pipefail script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") -om_version=$(grep -E "^\s*-\s*&ops_manager_60_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') -export om_version +OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_60_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') +export OM_VERSION diff --git a/scripts/dev/contexts/variables/om70 b/scripts/dev/contexts/variables/om70 index c0c8b0eb7..4f758459b 100644 --- a/scripts/dev/contexts/variables/om70 +++ b/scripts/dev/contexts/variables/om70 @@ -18,4 +18,4 @@ export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" export CUSTOM_APPDB_VERSION=7.0.18-ent export TEST_MODE=opsmanager -export OPS_MANAGER_REGISTRY="${BASE_REPO_URL}" +export OPS_MANAGER_REGISTRY="${REGISTRY}" diff --git a/scripts/dev/contexts/variables/om70_image b/scripts/dev/contexts/variables/om70_image index 108fe158e..85ee9f9af 100644 --- a/scripts/dev/contexts/variables/om70_image +++ b/scripts/dev/contexts/variables/om70_image @@ -5,5 +5,5 @@ set -Eeou pipefail script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") -om_version=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') -export om_version +OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') +export OM_VERSION diff --git a/scripts/dev/contexts/variables/om80 b/scripts/dev/contexts/variables/om80 index f0b677d90..433dff7aa 100644 --- a/scripts/dev/contexts/variables/om80 +++ b/scripts/dev/contexts/variables/om80 @@ -18,4 +18,4 @@ export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" export CUSTOM_APPDB_VERSION=8.0.6-ent export TEST_MODE=opsmanager -export OPS_MANAGER_REGISTRY="${BASE_REPO_URL}" +export OPS_MANAGER_REGISTRY="${REGISTRY}" diff --git a/scripts/dev/contexts/variables/om80_image b/scripts/dev/contexts/variables/om80_image index 7821d0b01..d0482b11b 100644 --- a/scripts/dev/contexts/variables/om80_image +++ b/scripts/dev/contexts/variables/om80_image @@ -5,7 +5,5 @@ set -Eeou pipefail script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") -om_version=$(grep -E "^\s*-\s*&ops_manager_80_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') -export om_version - -export om_download_url +OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_80_latest\s+(\S+)\s+#" < "${script_dir}"/../../../../.evergreen.yml | awk '{print $3}') +export OM_VERSION diff --git a/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml b/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml index 1071e6770..2a3e37ff3 100644 --- a/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml +++ b/scripts/evergreen/deployments/test-app/templates/mongodb-enterprise-tests.yaml @@ -115,7 +115,7 @@ spec: - name: POD_NAME value: 'mongodb-enterprise-operator-testing-pod' - name: VERSION_ID - value: {{ .Values.tag }} + value: {{ .Values.versionId }} - name: REGISTRY value: {{ .Values.registry }} {{- if .Values.multiCluster.memberClusters }} @@ -190,7 +190,7 @@ spec: value: {{ .Values.cognito_workload_url }} - name: cognito_workload_user_id value: {{ .Values.cognito_workload_user_id }} - image: {{ .Values.repo }}/mongodb-kubernetes-tests:{{ .Values.tag }} + image: "{{ .Values.mekoTestsRegistry }}/mongodb-kubernetes-tests:{{ .Values.mekoTestsVersion }}" # Options to pytest command should go in the pytest.ini file. command: ["pytest"] {{ if .Values.otel_endpoint }} diff --git a/scripts/evergreen/deployments/test-app/values.yaml b/scripts/evergreen/deployments/test-app/values.yaml index fe171c27a..13aba3df8 100644 --- a/scripts/evergreen/deployments/test-app/values.yaml +++ b/scripts/evergreen/deployments/test-app/values.yaml @@ -7,7 +7,9 @@ managedSecurityContext: false apiKey: omApiKey orgId: "" projectId: omProjectId -tag: +mekoTestsRegistry: +mekoTestsVersion: +versionId: taskName: ${TASK_NAME} pytest: diff --git a/scripts/evergreen/e2e/build_tests_image_ibm.sh b/scripts/evergreen/e2e/build_tests_image_ibm.sh index 6acb880e4..d82ae9661 100755 --- a/scripts/evergreen/e2e/build_tests_image_ibm.sh +++ b/scripts/evergreen/e2e/build_tests_image_ibm.sh @@ -8,7 +8,7 @@ cp release.json docker/mongodb-kubernetes-tests/release.json cp requirements.txt docker/mongodb-kubernetes-tests/requirements.txt cp -rf helm_chart docker/mongodb-kubernetes-tests/helm_chart -echo "Building mongodb-kubernetes-tests image with tag: ${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" +echo "Building mongodb-kubernetes-tests image with tag: ${REGISTRY}/mongodb-kubernetes-tests:${OPERATOR_VERSION}-$(arch)" cd docker/mongodb-kubernetes-tests || exit -sudo podman buildx build --progress plain . -f Dockerfile -t "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" --build-arg PYTHON_VERSION="${PYTHON_VERSION}" -sudo podman push --authfile="/root/.config/containers/auth.json" "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" +sudo podman buildx build --progress plain . -f Dockerfile -t "${REGISTRY}/mongodb-kubernetes-tests:${OPERATOR_VERSION}-$(arch)" --build-arg PYTHON_VERSION="${PYTHON_VERSION}" +sudo podman push --authfile="/root/.config/containers/auth.json" "${REGISTRY}/mongodb-kubernetes-tests:${OPERATOR_VERSION}-$(arch)" diff --git a/scripts/evergreen/e2e/single_e2e.sh b/scripts/evergreen/e2e/single_e2e.sh index f14cf9ab9..054470eef 100755 --- a/scripts/evergreen/e2e/single_e2e.sh +++ b/scripts/evergreen/e2e/single_e2e.sh @@ -22,23 +22,20 @@ deploy_test_app() { local context=${1} local helm_template_file helm_template_file=$(mktemp) - tag="${VERSION_ID:-latest}" - if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then - tag="${OVERRIDE_VERSION_ID}" - fi + meko_tests_version="${OPERATOR_VERSION}" local arch arch=$(uname -m) case "${arch}" in ppc64le) - tag="${tag}-ppc64le" + meko_tests_version="${meko_tests_version}-ppc64le" ;; s390x) - tag="${tag}-s390x" + meko_tests_version="${meko_tests_version}-s390x" ;; *) - echo "Not IBM host, using default tag" + echo "Not IBM host, using default meko_tests_version" ;; esac @@ -51,10 +48,11 @@ deploy_test_app() { # note, that the 4 last parameters are used only for Mongodb resource testing - not for Ops Manager helm_params=( "--set" "taskId=${task_id:-'not-specified'}" - "--set" "repo=${BASE_REPO_URL:=268558157000.dkr.ecr.us-east-1.amazonaws.com/dev}" "--set" "namespace=${NAMESPACE}" "--set" "taskName=${task_name}" - "--set" "tag=${tag}" + "--set" "mekoTestsRegistry=${MEKO_TESTS_REGISTRY}" + "--set" "mekoTestsVersion=${meko_tests_version}" + "--set" "versionId=${VERSION_ID}" "--set" "aws.accessKey=${AWS_ACCESS_KEY_ID}" "--set" "aws.secretAccessKey=${AWS_SECRET_ACCESS_KEY}" "--set" "skipExecution=${SKIP_EXECUTION:-'false'}" @@ -64,7 +62,7 @@ deploy_test_app() { "--set" "orgId=${OM_ORGID:-}" "--set" "imagePullSecrets=image-registries-secret" "--set" "managedSecurityContext=${MANAGED_SECURITY_CONTEXT:-false}" - "--set" "registry=${REGISTRY:-${BASE_REPO_URL}/${IMAGE_TYPE}}" + "--set" "registry=${REGISTRY}" "--set" "mdbDefaultArchitecture=${MDB_DEFAULT_ARCHITECTURE:-'non-static'}" "--set" "mdbImageType=${MDB_IMAGE_TYPE:-'ubi8'}" "--set" "clusterDomain=${CLUSTER_DOMAIN:-'cluster.local'}" diff --git a/scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh b/scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh index 4dea15c6c..7b5525794 100755 --- a/scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh +++ b/scripts/evergreen/operator-sdk/prepare-openshift-bundles-for-e2e.sh @@ -20,8 +20,9 @@ set -Eeou pipefail # so this channel has an entry without the replaces field. # # Required env vars: -# - BASE_REPO_URL (or REGISTRY for EVG run) +# - REGISTRY (registry to push bundles to) # - VERSION_ID (set in EVG as patch-id) +# - OPERATOR_VERSION (version of the current operator being built) # for get_operator_helm_values function source scripts/funcs/operator_deployment @@ -34,12 +35,6 @@ increment_version() { echo "${major}.${minor}.${patch}" } -if [[ "${REGISTRY:-""}" != "" ]]; then - base_repo_url="${REGISTRY}" -else - base_repo_url="${BASE_REPO_URL:-"268558157000.dkr.ecr.us-east-1.amazonaws.com/dev"}" -fi - # Generates helm charts the same way they are generates part of pre-commit hook. # We also provide helm values override the same way it's done when installing the operator helm chart in e2e tests. generate_helm_charts() { @@ -202,16 +197,16 @@ meko_package_name="mongodb-enterprise" certified_operators_repo="https://github.com/redhat-openshift-ecosystem/certified-operators.git" current_operator_version_from_release_json=$(jq -r .mongodbOperator BuildInfo: +def load_build_info(scenario: BuildScenario) -> BuildInfo: f""" Load build information based on the specified scenario. :param scenario: BuildScenario enum value indicating the build scenario (e.g. "development", "patch", "staging", "release"). "development" scenario will return build info for "patch" scenario. - :param repository_path: Path to the Git repository. Default is the current directory `{DEFAULT_REPOSITORY_PATH}`. - :param changelog_sub_path: Path to the changelog directory relative to the repository root. Default is '{DEFAULT_CHANGELOG_PATH}'. - :param initial_commit_sha: SHA of the initial commit to start from if no previous version tag is found. If not provided, it will be determined based on `{RELEASE_INITIAL_VERSION_ENV_VAR} environment variable. - :param initial_version: Initial version to use if no previous version tag is found. If not provided, it will be determined based on `{RELEASE_INITIAL_VERSION_ENV_VAR}` environment variable. :return: BuildInfo object containing images, binaries, and helm charts information for specified scenario. """ - if not initial_commit_sha: - initial_commit_sha = get_initial_commit_sha() - if not initial_version: - initial_version = get_initial_version() - - version = scenario.get_version(repository_path, changelog_sub_path, initial_commit_sha, initial_version) - # For manual_release, version can be None and will be set by image-specific logic - with open("build_info.json", "r") as f: build_info = json.load(f) @@ -99,15 +71,9 @@ def load_build_info( # If no scenario_data is available for the scenario, skip this image continue - # Only update the image_version if it is not already set in the build_info.json file - image_version = scenario_data.get("version") - if not image_version and version is not None: - image_version = version - images[name] = ImageInfo( repositories=scenario_data["repositories"], platforms=scenario_data["platforms"], - version=image_version, dockerfile_path=data["dockerfile-path"], sign=scenario_data.get("sign", False), latest_tag=scenario_data.get("latest-tag", False), @@ -124,7 +90,6 @@ def load_build_info( binaries[name] = BinaryInfo( s3_store=scenario_data["s3-store"], platforms=scenario_data["platforms"], - version=version, sign=scenario_data.get("sign", False), ) @@ -137,7 +102,6 @@ def load_build_info( helm_charts[name] = HelmChartInfo( repositories=scenario_data["repositories"], - version=version, sign=scenario_data.get("sign", False), ) diff --git a/scripts/release/build/build_scenario.py b/scripts/release/build/build_scenario.py index a8cda4a72..5fdaf3344 100644 --- a/scripts/release/build/build_scenario.py +++ b/scripts/release/build/build_scenario.py @@ -1,14 +1,5 @@ from enum import StrEnum -from git import Repo - -from lib.base_logger import logger -from scripts.release.constants import triggered_by_git_tag, is_evg_patch, is_running_in_evg, get_version_id, \ - get_github_commit -from scripts.release.version import calculate_next_version - -COMMIT_SHA_LENGTH = 8 - class BuildScenario(StrEnum): RELEASE = "release" # Official release triggered by a git tag @@ -16,54 +7,3 @@ class BuildScenario(StrEnum): PATCH = "patch" # CI build for a patch/pull request STAGING = "staging" # CI build from a merge to the master DEVELOPMENT = "development" # Local build on a developer machine - - @classmethod - def infer_scenario_from_environment(cls) -> "BuildScenario": - """Infer the build scenario from environment variables.""" - git_tag = triggered_by_git_tag() - is_patch = is_evg_patch() - is_evg = is_running_in_evg() - patch_id = get_version_id() - commit_sha = get_github_commit() - - if git_tag: - # Release scenario and the git tag will be used for promotion process only - scenario = BuildScenario.RELEASE - logger.info(f"Build scenario: {scenario} (git_tag: {git_tag})") - elif is_patch or is_evg: - scenario = BuildScenario.PATCH - logger.info(f"Build scenario: {scenario} (patch_id: {patch_id})") - # TODO: Uncomment the following lines when starting to work on staging builds - # elif is_evg: - # scenario = BuildScenario.STAGING - # logger.info(f"Build scenario: {scenario} (commit_sha: {commit_sha[:COMMIT_SHA_LENGTH]})") - else: - scenario = BuildScenario.DEVELOPMENT - logger.info(f"Build scenario: {scenario}") - - return scenario - - def get_version(self, repository_path: str, changelog_sub_path: str, initial_commit_sha: str = None, - initial_version: str = None) -> str: - repo = Repo(repository_path) - - match self: - case BuildScenario.DEVELOPMENT: - # When working locally, "version_id" env variable is defined in the generated context file. It is "latest" by - # default, and can be overridden with OVERRIDE_VERSION_ID - return "latest" - case BuildScenario.PATCH: - patch_id = get_version_id() - if not patch_id: - raise ValueError(f"version_id environment variable is not set for `{self}` build scenario") - return patch_id - case BuildScenario.STAGING: - return repo.head.object.hexsha[:COMMIT_SHA_LENGTH] - case BuildScenario.RELEASE: - return calculate_next_version(repo, changelog_sub_path, initial_commit_sha, initial_version) - case BuildScenario.MANUAL_RELEASE: - # For manual releases, version must be provided externally (e.g., for ops-manager via om_version env var, - # for agent via release.json). Return None to indicate version will be set by image-specific logic. - return None - - raise ValueError(f"Unknown build scenario: {self}") diff --git a/scripts/release/constants.py b/scripts/release/constants.py index dd0e462c2..7fe0d4de4 100644 --- a/scripts/release/constants.py +++ b/scripts/release/constants.py @@ -1,62 +1,3 @@ -import os - -RELEASE_INITIAL_VERSION_ENV_VAR = "RELEASE_INITIAL_VERSION" -RELEASE_INITIAL_COMMIT_SHA_ENV_VAR = "RELEASE_INITIAL_COMMIT_SHA" - DEFAULT_RELEASE_INITIAL_VERSION = "1.0.0" DEFAULT_CHANGELOG_PATH = "changelog/" DEFAULT_REPOSITORY_PATH = "." - - -def get_initial_version() -> str | None: - return os.getenv(RELEASE_INITIAL_VERSION_ENV_VAR) - - -def get_initial_commit_sha() -> str | None: - return os.getenv(RELEASE_INITIAL_COMMIT_SHA_ENV_VAR) - - -def triggered_by_git_tag() -> str | None: - """ - "triggered_by_git_tag" is the name of the tag that triggered this version, if applicable. It will be None for - all patches except when tagging a commit on GitHub - :return: tag name if the build was triggered by a git tag, otherwise None. - """ - return os.getenv("triggered_by_git_tag") - - -def is_evg_patch() -> bool: - """ - A patch build is a version not triggered by a commit to a repository. "is_patch" is passed automatically by Evergreen. - It either runs tasks on a base commit plus some diff if submitted by the CLI or on a git branch if created by - a GitHub pull request. - :return: "true" if the running task is in a patch build, otherwise "false". - """ - return os.getenv("is_patch", "false").lower() == "true" - - -def is_running_in_evg() -> bool: - """ - "RUNNING_IN_EVG" is set by us in evg-private-context - :return: "true" if the script is running in Evergreen, otherwise "false". - """ - return os.getenv("RUNNING_IN_EVG", "false").lower() == "true" - - -def get_version_id() -> str | None: - """ - Get the version ID from the environment variable. This is typically used for patch builds in the Evergreen CI system. - It is generated automatically for each task run. For example: `6899b7e35bfaee00077db986` for a manual/PR patch, - or `mongodb_kubernetes_5c5a3accb47bb411682b8c67f225b61f7ad5a619` for a master merge - :return: version_id (patch ID) or None if not set - """ - return os.getenv("version_id") - - -def get_github_commit() -> str | None: - """ - ${github_commit} is the commit hash of the commit that triggered the patch run. - For non pull-request patches, it will be the same as ${revision}. - :return: github_commit or None if not set - """ - return os.getenv("github_commit") diff --git a/scripts/release/pipeline_main.py b/scripts/release/pipeline.py similarity index 88% rename from scripts/release/pipeline_main.py rename to scripts/release/pipeline.py index 010620284..254122283 100644 --- a/scripts/release/pipeline_main.py +++ b/scripts/release/pipeline.py @@ -98,7 +98,7 @@ def build_image(image_name: str, build_configuration: ImageBuildConfiguration): def image_build_config_from_args(args) -> ImageBuildConfiguration: image = args.image - build_scenario = get_scenario_from_arg(args.build_scenario) or BuildScenario.infer_scenario_from_environment() + build_scenario = get_scenario_from_arg(args.build_scenario) build_info = load_build_info(build_scenario) logger.info(f"image is {image}") logger.info(f"images are {build_info.images}") @@ -108,7 +108,7 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration: raise ValueError(f"Image '{image}' is not defined in the build info for scenario '{build_scenario}'") # Resolve final values with overrides - version = args.version or image_build_info.version + version = args.version latest_tag = image_build_info.latest_tag olm_tag = image_build_info.olm_tag if args.registry: @@ -119,9 +119,9 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration: sign = args.sign or image_build_info.sign dockerfile_path = image_build_info.dockerfile_path - # Validate version - only ops-manager and agent can have None version as the versions are managed by the agent - # and om methods themselves, which are externally retrieved - om_version env var and release.json respectively - if version is None and image not in ["ops-manager", "agent"]: + # Validate version - only agent can have None version as the versions are managed by the agent + # which are externally retrieved from release.json + if version is None and image != "agent": raise ValueError(f"Version cannot be empty for {image}.") return ImageBuildConfiguration( @@ -141,9 +141,6 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration: def get_scenario_from_arg(args_scenario: str) -> BuildScenario | None: - if not args_scenario: - return None - try: return BuildScenario(args_scenario) except ValueError as e: @@ -200,8 +197,7 @@ def main(): parser = argparse.ArgumentParser( description="""Builder tool for container images. It allows to push and sign images with multiple architectures using Docker Buildx. -By default build information is read from 'build_info.json' file in the project root directory based on the build scenario. -It can be inferred from the environment variables or overridden with the '--build-scenario' option.""", +By default build information is read from 'build_info.json' file in the project root directory based on the build scenario.""", ) parser.add_argument( "image", @@ -216,10 +212,11 @@ def main(): "--build-scenario", metavar="", action="store", + required=True, type=str, choices=supported_scenarios, - help=f"""Override the build scenario instead of inferring from environment. Options: {", ".join(supported_scenarios)}. -Default is to infer from environment variables. For '{BuildScenario.DEVELOPMENT}' the '{BuildScenario.PATCH}' scenario is used to read values from 'build_info.json'""", + help=f"""Build scenario when reading configuration from 'build_info.json'. +Options: {", ".join(supported_scenarios)}. For '{BuildScenario.DEVELOPMENT}' the '{BuildScenario.PATCH}' scenario is used to read values from 'build_info.json'""", ) parser.add_argument( "-p", @@ -235,7 +232,7 @@ def main(): metavar="", action="store", type=str, - help="Override the version/tag instead of resolving from build scenario. Default is to infer from environment variables based on the selected scenario.", + help="Version to use when building container image. Required for all images except for agent where we read it from release.json", ) parser.add_argument( "-r", diff --git a/scripts/release/pipeline.sh b/scripts/release/pipeline.sh new file mode 100755 index 000000000..703bbcac1 --- /dev/null +++ b/scripts/release/pipeline.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +source scripts/dev/set_env_context.sh + +scripts/dev/run_python.sh scripts/release/pipeline.py "${IMAGE_NAME}" --build-scenario "${BUILD_SCENARIO}" --version "${OPERATOR_VERSION}" diff --git a/scripts/release/pipeline_agent.sh b/scripts/release/pipeline_agent.sh new file mode 100755 index 000000000..43740a6cb --- /dev/null +++ b/scripts/release/pipeline_agent.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +source scripts/dev/set_env_context.sh + +if [[ "${FLAGS:-}" = "" ]]; then + FLAGS="--parallel" +else + FLAGS="--parallel ${FLAGS}" +fi + +scripts/dev/run_python.sh scripts/release/pipeline.py agent \ + --build-scenario "${BUILD_SCENARIO}" \ + "${FLAGS}" diff --git a/scripts/release/pipeline_migrate_agent.sh b/scripts/release/pipeline_migrate_agent.sh deleted file mode 100755 index 2433457bc..000000000 --- a/scripts/release/pipeline_migrate_agent.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel agent \ - --all-agents \ - --build-scenario manual_release \ - -r quay.io/mongodb/mongodb-agent diff --git a/scripts/release/pipeline_ops_manager.sh b/scripts/release/pipeline_ops_manager.sh new file mode 100755 index 000000000..2c095a28a --- /dev/null +++ b/scripts/release/pipeline_ops_manager.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +source scripts/dev/set_env_context.sh + +scripts/dev/run_python.sh scripts/release/pipeline.py ops-manager \ + --build-scenario "${BUILD_SCENARIO}" \ + --version "${OM_VERSION}" diff --git a/scripts/release/pipeline_readiness_probe.sh b/scripts/release/pipeline_readiness_probe.sh new file mode 100755 index 000000000..a3aff54fa --- /dev/null +++ b/scripts/release/pipeline_readiness_probe.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +source scripts/dev/set_env_context.sh + +scripts/dev/run_python.sh scripts/release/pipeline.py readiness-probe \ + --build-scenario "${BUILD_SCENARIO}" \ + --version "${READINESS_PROBE_VERSION}" diff --git a/scripts/release/pipeline_version_upgrade_hook.sh b/scripts/release/pipeline_version_upgrade_hook.sh new file mode 100755 index 000000000..a8f135604 --- /dev/null +++ b/scripts/release/pipeline_version_upgrade_hook.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +source scripts/dev/set_env_context.sh + +scripts/dev/run_python.sh scripts/release/pipeline.py upgrade-hook \ + --build-scenario "${BUILD_SCENARIO}" \ + --version "${VERSION_UPGRADE_HOOK_VERSION}" diff --git a/scripts/release/release_info.py b/scripts/release/release_info.py index 487d5a66a..5ae0bcf8c 100644 --- a/scripts/release/release_info.py +++ b/scripts/release/release_info.py @@ -30,17 +30,12 @@ UPGRADE_HOOK_IMAGE, ] +# TODO: this is dummy version, to be replaced with actual versioning logic +DUMMY_VERSION = "dummy_version" -def create_release_info_json( - repository_path: str, changelog_sub_path: str, initial_commit_sha: str = None, initial_version: str = None -) -> str: - build_info = load_build_info( - scenario=BuildScenario.RELEASE, - repository_path=repository_path, - changelog_sub_path=changelog_sub_path, - initial_commit_sha=initial_commit_sha, - initial_version=initial_version, - ) + +def create_release_info_json() -> str: + build_info = load_build_info(scenario=BuildScenario.RELEASE) release_info_json = convert_to_release_info_json(build_info) @@ -60,19 +55,19 @@ def convert_to_release_info_json(build_info: BuildInfo) -> dict: output["images"][name] = { "repositories": image.repositories, "platforms": image.platforms, - "version": image.version, + "version": DUMMY_VERSION, } for name, binary in build_info.binaries.items(): output["binaries"][name] = { "platforms": binary.platforms, - "version": binary.version, + "version": DUMMY_VERSION, } for name, chart in build_info.helm_charts.items(): output["helm-charts"][name] = { "repositories": chart.repositories, - "version": chart.version, + "version": DUMMY_VERSION, } return output @@ -83,53 +78,9 @@ def convert_to_release_info_json(build_info: BuildInfo) -> dict: description="Create relevant release artifacts information in JSON format.", formatter_class=argparse.RawTextHelpFormatter, ) - parser.add_argument( - "-p", - "--path", - default=DEFAULT_REPOSITORY_PATH, - metavar="", - action="store", - type=pathlib.Path, - help="Path to the Git repository. Default is the current directory '.'", - ) - parser.add_argument( - "-c", - "--changelog-path", - default=DEFAULT_CHANGELOG_PATH, - metavar="", - action="store", - type=str, - help=f"Path to the changelog directory relative to a current working directory. Default is '{DEFAULT_CHANGELOG_PATH}'", - ) - parser.add_argument( - "-s", - "--initial-commit-sha", - metavar="", - action="store", - type=str, - help="SHA of the initial commit to start from if no previous version tag is found.", - ) - parser.add_argument( - "-v", - "--initial-version", - default=DEFAULT_RELEASE_INITIAL_VERSION, - metavar="", - action="store", - type=str, - help=f"Version to use if no previous version tag is found. Default is '{DEFAULT_RELEASE_INITIAL_VERSION}'", - ) - parser.add_argument( - "--output", - "-o", - metavar="", - type=pathlib.Path, - help="Path to save the release information file. If not provided, prints to stdout.", - ) args = parser.parse_args() - release_info = create_release_info_json( - args.path, args.changelog_path, args.initial_commit_sha, args.initial_version - ) + release_info = create_release_info_json() if args.output is not None: with open(args.output, "w") as file: diff --git a/scripts/release/retag_images_to_staging.sh b/scripts/release/retag_images_to_staging.sh new file mode 100755 index 000000000..340a45ca7 --- /dev/null +++ b/scripts/release/retag_images_to_staging.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +# Utility used to retag and push container images from one repo to another +# Useful for migrating images between different repositories (e.g. dev -> staging) + +image_exists() { + local image_tag="$1" + if docker manifest inspect "${image_tag}" > /dev/null 2>&1; then + return 0 # Image exists + else + return 1 # Image doesn't exist + fi +} + +get_arch_digest() { + local image="$1" + local arch="$2" + local manifest_json + manifest_json=$(docker buildx imagetools inspect --raw "${image}" 2>/dev/null || echo '{}') + + local media_type + media_type=$(echo "${manifest_json}" | jq -r '.mediaType // empty') + + if [[ "${media_type}" == *"manifest.list"* ]]; then + # this is a multi-arch manifest + local arch_digest + arch_digest=$(echo "${manifest_json}" | jq -r ".manifests[] | select(.platform.architecture == \"${arch}\" and .platform.os == \"linux\") | .digest") + + if [[ -n "${arch_digest}" && "${arch_digest}" != "null" ]]; then + echo "${arch_digest}" + return 0 + fi + elif [[ "${arch}" == "amd64" ]]; then + # otherwise it must be a single-arch (image) manifest, so we return it only if we ask for amd64 + local arch_digest + arch_digest="sha256:$(echo -n "${manifest_json}" | shasum --algorithm 256 | head -c 64)" + echo "${arch_digest}" + fi + + echo "" + return 0 +} + +process_image() { + local source_image="$1" + local target_image="$2" + + echo " Processing ${source_image}..." + + local digest_arm64 + local digest_amd64 + digest_arm64=$(get_arch_digest "${source_image}" arm64) + digest_amd64=$(get_arch_digest "${source_image}" amd64) + + if [[ -n "${digest_amd64}" ]]; then + docker pull "${source_image}@${digest_amd64}" + docker tag "${source_image}@${digest_amd64}" "${target_image}-amd64" + docker push "${target_image}-amd64" + fi + + if [[ -n "${digest_arm64}" ]]; then + docker pull "${source_image}@${digest_arm64}" + docker tag "${source_image}@${digest_arm64}" "${target_image}-arm64" + docker push "${target_image}-arm64" + fi + + docker manifest create "${target_image}" ${digest_amd64:+--amend ${target_image}-amd64} ${digest_arm64:+--amend ${target_image}-arm64} + docker manifest push "${target_image}" +} + +retag_container_image() { + local image_name="$1" + local version="$2" + local old_repo="$3" + local new_repo="$4" + + local old_tag="${old_repo}/${image_name}:${version}" + local new_tag="${new_repo}/${image_name}:${version}" + + if image_exists "${new_tag}"; then + echo "Image ${new_tag} exists, skipping" + else + process_image "${old_tag}" "${new_tag}" + fi + + return 0 +} + +versions=$(jq -r '.supportedImages."ops-manager".versions[]' release.json) + +# Iterate over each version +for version in ${versions}; do + echo "Retagging ops-manager version: ${version}" + retag_container_image "mongodb-enterprise-ops-manager-ubi" "${version}" "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" "268558157000.dkr.ecr.us-east-1.amazonaws.com/staging" +done diff --git a/scripts/release/atomic_pipeline_test.py b/scripts/release/tests/atomic_pipeline_test.py similarity index 100% rename from scripts/release/atomic_pipeline_test.py rename to scripts/release/tests/atomic_pipeline_test.py diff --git a/scripts/release/tests/build_info_test.py b/scripts/release/tests/build_info_test.py index fd4e6ded0..52cbc248e 100644 --- a/scripts/release/tests/build_info_test.py +++ b/scripts/release/tests/build_info_test.py @@ -1,7 +1,3 @@ -import os - -from git import Repo - from scripts.release.build.build_info import ( BinaryInfo, BuildInfo, @@ -12,63 +8,53 @@ from scripts.release.build.build_scenario import BuildScenario -def test_load_build_info_development(git_repo: Repo): - version = "latest" - +# TODO: Target testdata (test build_info.json file) and not the production build_info.json file from codebase +def test_load_build_info_development(): expected_build_info = BuildInfo( images={ "operator": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", ), "operator-race": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", ), "init-database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-database"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-database/Dockerfile", ), "init-appdb": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-appdb"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-appdb/Dockerfile", ), "init-ops-manager": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-ops-manager"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-ops-manager/Dockerfile", ), "database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-database"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile", ), "mco-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-community-tests"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-community-tests/Dockerfile", ), "meko-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-tests/Dockerfile", ), "readiness-probe": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-readinessprobe/Dockerfile", ), "upgrade-hook": ImageInfo( @@ -76,19 +62,16 @@ def test_load_build_info_development(git_repo: Repo): "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-operator-version-upgrade-post-start-hook" ], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile", ), "agent": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-agent"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-agent/Dockerfile", ), "ops-manager": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-enterprise-ops-manager-ubi"], platforms=["linux/amd64"], - version="om-version-from-release.json", dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile", ), }, @@ -96,80 +79,66 @@ def test_load_build_info_development(git_repo: Repo): "kubectl-mongodb": BinaryInfo( s3_store="s3://kubectl-mongodb/dev", platforms=["linux/amd64"], - version=version, ) }, helm_charts={ "mongodb-kubernetes": HelmChartInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/helm-charts"], - version=version, ) }, ) - build_info = load_build_info(BuildScenario.DEVELOPMENT, git_repo.working_dir) + build_info = load_build_info(BuildScenario.DEVELOPMENT) assert build_info == expected_build_info -def test_load_build_info_patch(git_repo: Repo): - patch_id = "688364423f9b6c00072b3556" - os.environ["version_id"] = patch_id - +def test_load_build_info_patch(): expected_build_info = BuildInfo( images={ "operator": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", ), "operator-race": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", ), "init-database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-database"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-init-database/Dockerfile", ), "init-appdb": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-appdb"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-init-appdb/Dockerfile", ), "init-ops-manager": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-ops-manager"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-init-ops-manager/Dockerfile", ), "database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-database"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile", ), "mco-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-community-tests"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-community-tests/Dockerfile", ), "meko-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-tests/Dockerfile", ), "readiness-probe": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-readinessprobe/Dockerfile", ), "upgrade-hook": ImageInfo( @@ -177,19 +146,16 @@ def test_load_build_info_patch(git_repo: Repo): "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-operator-version-upgrade-post-start-hook" ], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile", ), "agent": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-agent"], platforms=["linux/amd64"], - version=patch_id, dockerfile_path="docker/mongodb-agent/Dockerfile", ), "ops-manager": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-enterprise-ops-manager-ubi"], platforms=["linux/amd64"], - version="om-version-from-release.json", dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile", ), }, @@ -197,47 +163,38 @@ def test_load_build_info_patch(git_repo: Repo): "kubectl-mongodb": BinaryInfo( s3_store="s3://kubectl-mongodb/dev", platforms=["linux/amd64"], - version=patch_id, ) }, helm_charts={ "mongodb-kubernetes": HelmChartInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/helm-charts"], - version=patch_id, ) }, ) - build_info = load_build_info(BuildScenario.PATCH, git_repo.working_dir) + build_info = load_build_info(BuildScenario.PATCH) assert build_info == expected_build_info -def test_load_build_info_staging(git_repo: Repo): - initial_commit = list(git_repo.iter_commits(reverse=True))[4] - git_repo.git.checkout(initial_commit) - expected_commit_sha = initial_commit.hexsha[:8] - +def test_load_build_info_staging(): expected_build_info = BuildInfo( images={ "operator": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", sign=True, ), "operator-race": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes"], platforms=["linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", sign=True, ), "init-database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-init-database"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-init-database/Dockerfile", latest_tag=True, sign=True, @@ -245,7 +202,6 @@ def test_load_build_info_staging(git_repo: Repo): "init-appdb": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-init-appdb"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-init-appdb/Dockerfile", latest_tag=True, sign=True, @@ -255,7 +211,6 @@ def test_load_build_info_staging(git_repo: Repo): "268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-init-ops-manager" ], platforms=["linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-init-ops-manager/Dockerfile", latest_tag=True, sign=True, @@ -263,7 +218,6 @@ def test_load_build_info_staging(git_repo: Repo): "database": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-database"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile", latest_tag=True, sign=True, @@ -271,19 +225,16 @@ def test_load_build_info_staging(git_repo: Repo): "mco-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-community-tests"], platforms=["linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-community-tests/Dockerfile", ), "meko-tests": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-tests"], platforms=["linux/arm64", "linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-tests/Dockerfile", ), "readiness-probe": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-readinessprobe"], platforms=["linux/arm64", "linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-readinessprobe/Dockerfile", latest_tag=True, sign=True, @@ -293,7 +244,6 @@ def test_load_build_info_staging(git_repo: Repo): "268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-operator-version-upgrade-post-start-hook" ], platforms=["linux/arm64", "linux/amd64"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile", latest_tag=True, sign=True, @@ -301,7 +251,6 @@ def test_load_build_info_staging(git_repo: Repo): "agent": ImageInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-agent"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=expected_commit_sha, dockerfile_path="docker/mongodb-agent/Dockerfile", sign=True, ), @@ -310,7 +259,6 @@ def test_load_build_info_staging(git_repo: Repo): "268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-enterprise-ops-manager-ubi" ], platforms=["linux/amd64"], - version="om-version-from-release.json", dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile", sign=True, ), @@ -319,36 +267,28 @@ def test_load_build_info_staging(git_repo: Repo): "kubectl-mongodb": BinaryInfo( s3_store="s3://kubectl-mongodb/staging", platforms=["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm64"], - version=expected_commit_sha, sign=True, ) }, helm_charts={ "mongodb-kubernetes": HelmChartInfo( repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/helm-charts"], - version=expected_commit_sha, sign=True, ) }, ) - build_info = load_build_info(BuildScenario.STAGING, git_repo.working_dir) + build_info = load_build_info(BuildScenario.STAGING) assert build_info == expected_build_info -def test_load_build_info_release( - git_repo: Repo, readinessprobe_version: str, operator_version_upgrade_post_start_hook_version: str -): - version = "1.2.0" - git_repo.git.checkout(version) - +def test_load_build_info_release(): expected_build_info = BuildInfo( images={ "operator": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=version, dockerfile_path="docker/mongodb-kubernetes-operator/Dockerfile", olm_tag=True, sign=True, @@ -356,7 +296,6 @@ def test_load_build_info_release( "init-database": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-init-database"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-database/Dockerfile", olm_tag=True, sign=True, @@ -364,7 +303,6 @@ def test_load_build_info_release( "init-appdb": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-init-appdb"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-appdb/Dockerfile", olm_tag=True, sign=True, @@ -372,7 +310,6 @@ def test_load_build_info_release( "init-ops-manager": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-init-ops-manager"], platforms=["linux/amd64"], - version=version, dockerfile_path="docker/mongodb-kubernetes-init-ops-manager/Dockerfile", olm_tag=True, sign=True, @@ -380,15 +317,18 @@ def test_load_build_info_release( "database": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-database"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=version, dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile", olm_tag=True, sign=True, ), + "meko-tests": ImageInfo( + repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], + platforms=["linux/amd64"], + dockerfile_path="docker/mongodb-kubernetes-tests/Dockerfile", + ), "readiness-probe": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-readinessprobe"], platforms=["linux/arm64", "linux/amd64"], - version=readinessprobe_version, dockerfile_path="docker/mongodb-kubernetes-readinessprobe/Dockerfile", olm_tag=True, sign=True, @@ -396,7 +336,6 @@ def test_load_build_info_release( "upgrade-hook": ImageInfo( repositories=["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], platforms=["linux/arm64", "linux/amd64"], - version=operator_version_upgrade_post_start_hook_version, dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile", olm_tag=True, sign=True, @@ -406,34 +345,28 @@ def test_load_build_info_release( "kubectl-mongodb": BinaryInfo( s3_store="s3://kubectl-mongodb/prod", platforms=["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm64"], - version=version, sign=True, ) }, helm_charts={ "mongodb-kubernetes": HelmChartInfo( repositories=["quay.io/mongodb/helm-charts"], - version=version, sign=True, ) }, ) - build_info = load_build_info(BuildScenario.RELEASE, git_repo.working_dir) + build_info = load_build_info(BuildScenario.RELEASE) assert build_info == expected_build_info -def test_load_build_info_manual_release(git_repo: Repo): - version = "1.2.0" - git_repo.git.checkout(version) - +def test_load_build_info_manual_release(): expected_build_info = BuildInfo( images={ "agent": ImageInfo( repositories=["quay.io/mongodb/mongodb-agent-ubi", "quay.io/mongodb/mongodb-agent"], platforms=["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - version=None, # Version is None for manual_release scenario dockerfile_path="docker/mongodb-agent/Dockerfile", olm_tag=True, sign=True, @@ -441,7 +374,6 @@ def test_load_build_info_manual_release(git_repo: Repo): "ops-manager": ImageInfo( repositories=["quay.io/mongodb/mongodb-enterprise-ops-manager-ubi"], platforms=["linux/amd64"], - version=None, # Version is None for manual_release scenario dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile", olm_tag=True, sign=True, @@ -451,6 +383,6 @@ def test_load_build_info_manual_release(git_repo: Repo): helm_charts={}, ) - build_info = load_build_info(BuildScenario.MANUAL_RELEASE, git_repo.working_dir) + build_info = load_build_info(BuildScenario.MANUAL_RELEASE) assert build_info == expected_build_info diff --git a/scripts/release/tests/build_scenario_test.py b/scripts/release/tests/build_scenario_test.py deleted file mode 100644 index 9f142572b..000000000 --- a/scripts/release/tests/build_scenario_test.py +++ /dev/null @@ -1,39 +0,0 @@ -import os - -from git import Repo - -from scripts.release.build.build_scenario import BuildScenario -from scripts.release.constants import DEFAULT_CHANGELOG_PATH - - -class TestGetVersionForBuildScenario: - - def test_patch_build_scenario(self, git_repo: Repo): - os.environ["BUILD_ID"] = "688364423f9b6c00072b3556" - expected_version = os.environ["BUILD_ID"] - - version = BuildScenario.PATCH.get_version( - repository_path=git_repo.working_dir, changelog_sub_path=DEFAULT_CHANGELOG_PATH - ) - - assert version == expected_version - - def test_staging_build_scenario(self, git_repo: Repo): - initial_commit = list(git_repo.iter_commits(reverse=True))[4] - git_repo.git.checkout(initial_commit) - expected_version = initial_commit.hexsha[:8] - - version = BuildScenario.STAGING.get_version( - repository_path=git_repo.working_dir, changelog_sub_path=DEFAULT_CHANGELOG_PATH - ) - - assert version == expected_version - - def test_release_build_scenario(self, git_repo: Repo): - git_repo.git.checkout("1.2.0") - - version = BuildScenario.RELEASE.get_version( - repository_path=git_repo.working_dir, changelog_sub_path=DEFAULT_CHANGELOG_PATH - ) - - assert version == "1.2.0" diff --git a/scripts/release/tests/conftest.py b/scripts/release/tests/conftest.py index 4974a7ac8..5e1188add 100644 --- a/scripts/release/tests/conftest.py +++ b/scripts/release/tests/conftest.py @@ -164,23 +164,3 @@ def add_file(repo_path: str, src_file_path: str, dst_file_path: str | None = Non src_path = os.path.join("scripts/release/tests/testdata", src_file_path) return shutil.copy(src_path, dst_path) - - -@fixture(scope="module") -def readinessprobe_version() -> str: - return get_manually_upgradable_versions()["readiness-probe"] - - -@fixture(scope="module") -def operator_version_upgrade_post_start_hook_version() -> str: - return get_manually_upgradable_versions()["upgrade-hook"] - - -def get_manually_upgradable_versions() -> Dict[str, str]: - with open("build_info.json", "r") as f: - build_info = json.load(f) - - return { - "readiness-probe": build_info["images"]["readiness-probe"]["release"]["version"], - "upgrade-hook": build_info["images"]["upgrade-hook"]["release"]["version"], - } diff --git a/scripts/release/tests/release_info_test.py b/scripts/release/tests/release_info_test.py index add0c2dd4..bc59a2e83 100644 --- a/scripts/release/tests/release_info_test.py +++ b/scripts/release/tests/release_info_test.py @@ -1,65 +1,58 @@ import json -from git import Repo +from scripts.release.release_info import DUMMY_VERSION, create_release_info_json -from scripts.release.constants import DEFAULT_CHANGELOG_PATH -from scripts.release.release_info import create_release_info_json - - -def test_create_release_info_json( - git_repo: Repo, readinessprobe_version: str, operator_version_upgrade_post_start_hook_version: str -): - git_repo.git.checkout("1.2.0") +def test_create_release_info_json(): expected_json = { "images": { "operator": { "repositories": ["quay.io/mongodb/mongodb-kubernetes"], "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - "version": "1.2.0", + "version": DUMMY_VERSION, }, "init-database": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-database"], "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - "version": "1.2.0", + "version": DUMMY_VERSION, }, "init-appdb": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-appdb"], "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - "version": "1.2.0", + "version": DUMMY_VERSION, }, "init-ops-manager": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-ops-manager"], "platforms": ["linux/amd64"], - "version": "1.2.0", + "version": DUMMY_VERSION, }, "database": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-database"], "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], - "version": "1.2.0", + "version": DUMMY_VERSION, }, "readiness-probe": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-readinessprobe"], "platforms": ["linux/arm64", "linux/amd64"], - "version": readinessprobe_version, + "version": DUMMY_VERSION, }, "upgrade-hook": { "repositories": ["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], "platforms": ["linux/arm64", "linux/amd64"], - "version": operator_version_upgrade_post_start_hook_version, + "version": DUMMY_VERSION, }, }, "binaries": { "kubectl-mongodb": { "platforms": ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm64"], - "version": "1.2.0", + "version": DUMMY_VERSION, } }, - "helm-charts": {"mongodb-kubernetes": {"repositories": ["quay.io/mongodb/helm-charts"], "version": "1.2.0"}}, + "helm-charts": { + "mongodb-kubernetes": {"repositories": ["quay.io/mongodb/helm-charts"], "version": DUMMY_VERSION} + }, } expected_release_info_json = json.dumps(expected_json, indent=2) - release_info_json = create_release_info_json( - repository_path=git_repo.working_dir, changelog_sub_path=DEFAULT_CHANGELOG_PATH - ) + release_info_json = create_release_info_json() assert release_info_json == expected_release_info_json From 29aa352efe3b735de00aef8be6e62e126dcc9140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Tue, 16 Sep 2025 12:21:21 +0200 Subject: [PATCH 02/21] agent_pipeline.py script fix --- scripts/release/pipeline_agent.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/release/pipeline_agent.sh b/scripts/release/pipeline_agent.sh index 43740a6cb..962eceb2a 100755 --- a/scripts/release/pipeline_agent.sh +++ b/scripts/release/pipeline_agent.sh @@ -10,6 +10,7 @@ else FLAGS="--parallel ${FLAGS}" fi +# shellcheck disable=SC2086 scripts/dev/run_python.sh scripts/release/pipeline.py agent \ --build-scenario "${BUILD_SCENARIO}" \ - "${FLAGS}" + ${FLAGS} From 992e3fb3d8428b67a78cdf6acbbf356675de76d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Tue, 16 Sep 2025 13:27:44 +0200 Subject: [PATCH 03/21] wip 2 --- .evergreen-release.yml | 18 ++++++++++++++++ build_info.json | 2 ++ release.json | 20 ++---------------- scripts/dev/contexts/evg-private-context | 12 +++++++++-- scripts/release/atomic_pipeline.py | 3 ++- scripts/release/build/build_info.py | 2 ++ .../build/image_build_configuration.py | 6 ++++-- scripts/release/build/image_build_process.py | 21 +++++++++++++++++++ 8 files changed, 61 insertions(+), 23 deletions(-) diff --git a/.evergreen-release.yml b/.evergreen-release.yml index 4010c3240..d5e822bfb 100644 --- a/.evergreen-release.yml +++ b/.evergreen-release.yml @@ -70,6 +70,24 @@ tasks: vars: IMAGE_NAME: database + - name: release_readiness_probe + tags: [ "image_release" ] + allowed_requesters: [ "patch", "github_tag" ] + commands: + - func: clone + - func: setup_building_host + - func: quay_login + - func: pipeline_readiness_probe + + - name: release_version_upgrade_hook + tags: [ "image_release" ] + allowed_requesters: [ "patch", "github_tag" ] + commands: + - func: clone + - func: setup_building_host + - func: quay_login + - func: pipeline_version_upgrade_hook + - name: prepare_and_upload_openshift_bundles tags: [ "openshift_bundles" ] allowed_requesters: [ "patch", "github_tag" ] diff --git a/build_info.json b/build_info.json index b85686891..991068cd1 100644 --- a/build_info.json +++ b/build_info.json @@ -221,6 +221,7 @@ "release": { "sign": true, "olm-tag": true, + "skip-if-exists": true, "repositories": [ "quay.io/mongodb/mongodb-kubernetes-readinessprobe" ], @@ -250,6 +251,7 @@ "release": { "sign": true, "olm-tag": true, + "skip-if-exists": true, "repositories": ["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], "platforms": [ "linux/arm64", diff --git a/release.json b/release.json index 2a1621524..553ccd8b6 100644 --- a/release.json +++ b/release.json @@ -8,6 +8,8 @@ "initAppDbVersion": "1.4.0", "databaseImageVersion": "1.4.0", "agentVersion": "108.0.12.8846-1", + "readinessProbe": "1.0.22", + "versionUpgradeHook": "1.0.9", "openshift": { "minimumSupportedVersion": "4.6" }, @@ -15,24 +17,6 @@ "version": "0.53.1" }, "supportedImages": { - "readinessprobe": { - "ssdlc_name": "MongoDB Controllers for Kubernetes Readiness Probe", - "versions": [ - "1.0.22" - ], - "variants": [ - "ubi" - ] - }, - "operator-version-upgrade-post-start-hook": { - "ssdlc_name": "MongoDB Controllers for Kubernetes Operator Version Upgrade Hook", - "versions": [ - "1.0.9" - ], - "variants": [ - "ubi" - ] - }, "ops-manager": { "ssdlc_name": "MongoDB Controllers for Kubernetes Enterprise Ops Manager", "versions": [ diff --git a/scripts/dev/contexts/evg-private-context b/scripts/dev/contexts/evg-private-context index 93374a409..9c6cf3d79 100644 --- a/scripts/dev/contexts/evg-private-context +++ b/scripts/dev/contexts/evg-private-context @@ -116,8 +116,8 @@ fi echo "Setting BUILD_SCENARIO=${BUILD_SCENARIO}" export BUILD_SCENARIO="${BUILD_SCENARIO}" -# Set REGISTRY and OPERATOR_VERSION based on build scenario -# REGISTRY and OPERATOR_VERSION can be overridden externally if needed +# Set REGISTRY and OPERATOR_VERSION, READINESS_PROBE_VERSION, VERSION_UPGRADE_HOOK_VERSION based on build scenario +# REGISTRY and OPERATOR_VERSION, READINESS_PROBE_VERSION, VERSION_UPGRADE_HOOK_VERSION can be overridden externally if needed PATCH_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com/dev" STAGING_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com/staging" RELEASE_REGISTRY="quay.io/mongodb" @@ -125,17 +125,25 @@ case $BUILD_SCENARIO in "${BUILD_SCENARIO_RELEASE}") REGISTRY="${REGISTRY:-$RELEASE_REGISTRY}" OPERATOR_VERSION="${OPERATOR_VERSION:-$GIT_TAG}" + READINESS_PROBE_VERSION_FROM_RELEASE_JSON="$(jq -r '.readinessProbe' "${PROJECT_DIR}/release.json")" + READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$READINESS_PROBE_VERSION_FROM_RELEASE_JSON}" + VERSION_UPGRADE_HOOK_VERSION_FROM_RELEASE_JSON="$(jq -r '.versionUpgradeHook' "${PROJECT_DIR}/release.json")" + VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$VERSION_UPGRADE_HOOK_VERSION_FROM_RELEASE_JSON}" ;; "${BUILD_SCENARIO_STAGING}") COMMIT_SHA_SHORT=$(git rev-parse --short=8 HEAD) REGISTRY="${REGISTRY:-$STAGING_REGISTRY}" OPERATOR_VERSION="${OPERATOR_VERSION:-$COMMIT_SHA_SHORT}" + READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$COMMIT_SHA_SHORT}" + VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$COMMIT_SHA_SHORT}" ;; "${BUILD_SCENARIO_PATCH}") REGISTRY="${REGISTRY:-$PATCH_REGISTRY}" OPERATOR_VERSION="${OPERATOR_VERSION:-$VERSION_ID}" + READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$VERSION_ID}" + VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$VERSION_ID}" ;; *) diff --git a/scripts/release/atomic_pipeline.py b/scripts/release/atomic_pipeline.py index 670269c46..ef9f9b7b6 100755 --- a/scripts/release/atomic_pipeline.py +++ b/scripts/release/atomic_pipeline.py @@ -25,7 +25,7 @@ generate_tools_build_args, ) from scripts.release.build.image_build_configuration import ImageBuildConfiguration -from scripts.release.build.image_build_process import execute_docker_build +from scripts.release.build.image_build_process import execute_docker_build, ecr_login_boto3 from scripts.release.build.image_signing import ( mongodb_artifactory_login, sign_image, @@ -91,6 +91,7 @@ def build_image( path=build_path, args=build_args, push=True, + skip_if_exists=build_configuration.skip_if_exists, platforms=build_configuration.platforms, ) diff --git a/scripts/release/build/build_info.py b/scripts/release/build/build_info.py index a1cf8c60f..67367a0c1 100644 --- a/scripts/release/build/build_info.py +++ b/scripts/release/build/build_info.py @@ -26,6 +26,7 @@ class ImageInfo: sign: bool = False latest_tag: bool = False olm_tag: bool = False + skip_if_exists: bool = False @dataclass @@ -78,6 +79,7 @@ def load_build_info(scenario: BuildScenario) -> BuildInfo: sign=scenario_data.get("sign", False), latest_tag=scenario_data.get("latest-tag", False), olm_tag=scenario_data.get("olm-tag", False), + skip_if_exists=scenario_data.get("skip-if-exists", False), ) binaries = {} diff --git a/scripts/release/build/image_build_configuration.py b/scripts/release/build/image_build_configuration.py index b62718276..8951299ea 100644 --- a/scripts/release/build/image_build_configuration.py +++ b/scripts/release/build/image_build_configuration.py @@ -14,11 +14,13 @@ class ImageBuildConfiguration: olm_tag: bool registries: List[str] dockerfile_path: str + platforms: Optional[List[str]] = None + sign: bool = False + skip_if_exists: bool = False + # Agent specific parallel: bool = False parallel_factor: int = 0 - platforms: Optional[List[str]] = None - sign: bool = False all_agents: bool = False currently_used_agents: bool = False diff --git a/scripts/release/build/image_build_process.py b/scripts/release/build/image_build_process.py index 02084a84a..9261df987 100644 --- a/scripts/release/build/image_build_process.py +++ b/scripts/release/build/image_build_process.py @@ -40,6 +40,12 @@ def ecr_login_boto3(region: str, account_id: str): logger.debug(f"ECR login succeeded: {status}") +def check_if_image_exists(image_tag: str) -> bool: + docker_cmd = python_on_whales.docker + + return docker_cmd.image.exists(image_tag) + + def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str: """ Ensures a Docker Buildx builder exists for multi-platform builds. @@ -79,6 +85,7 @@ def execute_docker_build( Dict[str, str], push: bool, platforms: list[str], + skip_if_exists: bool, builder_name: str = DEFAULT_BUILDER_NAME, ): """ @@ -98,6 +105,20 @@ def execute_docker_build( docker_cmd = python_on_whales.docker + if skip_if_exists: + filtered_tags = [] + for tag in tags: + if check_if_image_exists(tag): + logger.info(f"Image with tag {tag} already exists. Skipping it.") + else: + filtered_tags.append(tag) + + if not filtered_tags: + logger.info("All specified image tags already exist. Skipping build.") + return + + tags = filtered_tags + try: # Convert build args to the format expected by python_on_whales build_args = {k: str(v) for k, v in args.items()} From e25a4c9a68570a52b93eb656cb821c00380f09fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 11:07:06 +0200 Subject: [PATCH 04/21] Bump `readinessProbeVersion` to `1.0.23` and `versionUpgradeHookVersion` to `1.0.10` --- config/manager/manager.yaml | 4 ++-- helm_chart/values.yaml | 4 ++-- public/mongodb-kubernetes-multi-cluster.yaml | 4 ++-- public/mongodb-kubernetes-openshift.yaml | 4 ++-- public/mongodb-kubernetes.yaml | 4 ++-- release.json | 4 ++-- scripts/dev/contexts/evg-private-context | 4 ++-- scripts/evergreen/release/update_helm_values_files.py | 2 ++ scripts/release/atomic_pipeline.py | 4 +++- scripts/release/tests/build_info_test.py | 2 ++ 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index f9756d686..f0d9296d2 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -112,9 +112,9 @@ spec: - name: MDB_COMMUNITY_AGENT_IMAGE value: "quay.io/mongodb/mongodb-agent:108.0.2.8729-1" - name: VERSION_UPGRADE_HOOK_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.9" + value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.10" - name: READINESS_PROBE_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.22" + value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.23" - name: MDB_COMMUNITY_IMAGE value: "mongodb-community-server" - name: MDB_COMMUNITY_REPO_URL diff --git a/helm_chart/values.yaml b/helm_chart/values.yaml index 61e109c24..6fdd8244f 100644 --- a/helm_chart/values.yaml +++ b/helm_chart/values.yaml @@ -149,10 +149,10 @@ agent: # This is only used by the MongoDBCommunity resource reconciler - START versionUpgradeHook: name: mongodb-kubernetes-operator-version-upgrade-post-start-hook - version: 1.0.9 + version: 1.0.10 readinessProbe: name: mongodb-kubernetes-readinessprobe - version: 1.0.22 + version: 1.0.23 # This is only used by the MongoDBCommunity resource reconciler - END # This is used by AppDB and by static containers to determine the image that the operator uses for databases. diff --git a/public/mongodb-kubernetes-multi-cluster.yaml b/public/mongodb-kubernetes-multi-cluster.yaml index fdc348662..55292d334 100644 --- a/public/mongodb-kubernetes-multi-cluster.yaml +++ b/public/mongodb-kubernetes-multi-cluster.yaml @@ -421,9 +421,9 @@ spec: - name: MDB_COMMUNITY_AGENT_IMAGE value: "quay.io/mongodb/mongodb-agent:108.0.2.8729-1" - name: VERSION_UPGRADE_HOOK_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.9" + value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.10" - name: READINESS_PROBE_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.22" + value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.23" - name: MDB_COMMUNITY_IMAGE value: "mongodb-community-server" - name: MDB_COMMUNITY_REPO_URL diff --git a/public/mongodb-kubernetes-openshift.yaml b/public/mongodb-kubernetes-openshift.yaml index 8f34da280..e888cf23c 100644 --- a/public/mongodb-kubernetes-openshift.yaml +++ b/public/mongodb-kubernetes-openshift.yaml @@ -416,9 +416,9 @@ spec: - name: MDB_COMMUNITY_AGENT_IMAGE value: "quay.io/mongodb/mongodb-agent:108.0.2.8729-1" - name: VERSION_UPGRADE_HOOK_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.9" + value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.10" - name: READINESS_PROBE_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.22" + value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.23" - name: MDB_COMMUNITY_IMAGE value: "mongodb-community-server" - name: MDB_COMMUNITY_REPO_URL diff --git a/public/mongodb-kubernetes.yaml b/public/mongodb-kubernetes.yaml index da283ac3c..6a97c0bcf 100644 --- a/public/mongodb-kubernetes.yaml +++ b/public/mongodb-kubernetes.yaml @@ -417,9 +417,9 @@ spec: - name: MDB_COMMUNITY_AGENT_IMAGE value: "quay.io/mongodb/mongodb-agent:108.0.2.8729-1" - name: VERSION_UPGRADE_HOOK_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.9" + value: "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.10" - name: READINESS_PROBE_IMAGE - value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.22" + value: "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.23" - name: MDB_COMMUNITY_IMAGE value: "mongodb-community-server" - name: MDB_COMMUNITY_REPO_URL diff --git a/release.json b/release.json index 553ccd8b6..a6b005835 100644 --- a/release.json +++ b/release.json @@ -8,8 +8,8 @@ "initAppDbVersion": "1.4.0", "databaseImageVersion": "1.4.0", "agentVersion": "108.0.12.8846-1", - "readinessProbe": "1.0.22", - "versionUpgradeHook": "1.0.9", + "readinessProbeVersion": "1.0.23", + "versionUpgradeHookVersion": "1.0.10", "openshift": { "minimumSupportedVersion": "4.6" }, diff --git a/scripts/dev/contexts/evg-private-context b/scripts/dev/contexts/evg-private-context index 9c6cf3d79..c0b243dda 100644 --- a/scripts/dev/contexts/evg-private-context +++ b/scripts/dev/contexts/evg-private-context @@ -125,9 +125,9 @@ case $BUILD_SCENARIO in "${BUILD_SCENARIO_RELEASE}") REGISTRY="${REGISTRY:-$RELEASE_REGISTRY}" OPERATOR_VERSION="${OPERATOR_VERSION:-$GIT_TAG}" - READINESS_PROBE_VERSION_FROM_RELEASE_JSON="$(jq -r '.readinessProbe' "${PROJECT_DIR}/release.json")" + READINESS_PROBE_VERSION_FROM_RELEASE_JSON="$(jq -r '.readinessProbeVersion' "${PROJECT_DIR}/release.json")" READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$READINESS_PROBE_VERSION_FROM_RELEASE_JSON}" - VERSION_UPGRADE_HOOK_VERSION_FROM_RELEASE_JSON="$(jq -r '.versionUpgradeHook' "${PROJECT_DIR}/release.json")" + VERSION_UPGRADE_HOOK_VERSION_FROM_RELEASE_JSON="$(jq -r '.versionUpgradeHookVersion' "${PROJECT_DIR}/release.json")" VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$VERSION_UPGRADE_HOOK_VERSION_FROM_RELEASE_JSON}" ;; diff --git a/scripts/evergreen/release/update_helm_values_files.py b/scripts/evergreen/release/update_helm_values_files.py index e9eeef938..216d74d4b 100755 --- a/scripts/evergreen/release/update_helm_values_files.py +++ b/scripts/evergreen/release/update_helm_values_files.py @@ -27,6 +27,8 @@ "initAppDbVersion": "initAppDb", "databaseImageVersion": "database", "agentVersion": "agent", + "readinessProbeVersion": "readinessProbe", + "versionUpgradeHookVersion": "versionUpgradeHook", } diff --git a/scripts/release/atomic_pipeline.py b/scripts/release/atomic_pipeline.py index ef9f9b7b6..faf491030 100755 --- a/scripts/release/atomic_pipeline.py +++ b/scripts/release/atomic_pipeline.py @@ -25,7 +25,9 @@ generate_tools_build_args, ) from scripts.release.build.image_build_configuration import ImageBuildConfiguration -from scripts.release.build.image_build_process import execute_docker_build, ecr_login_boto3 +from scripts.release.build.image_build_process import ( + execute_docker_build, +) from scripts.release.build.image_signing import ( mongodb_artifactory_login, sign_image, diff --git a/scripts/release/tests/build_info_test.py b/scripts/release/tests/build_info_test.py index 52cbc248e..718ddddcd 100644 --- a/scripts/release/tests/build_info_test.py +++ b/scripts/release/tests/build_info_test.py @@ -330,6 +330,7 @@ def test_load_build_info_release(): repositories=["quay.io/mongodb/mongodb-kubernetes-readinessprobe"], platforms=["linux/arm64", "linux/amd64"], dockerfile_path="docker/mongodb-kubernetes-readinessprobe/Dockerfile", + skip_if_exists=True, olm_tag=True, sign=True, ), @@ -337,6 +338,7 @@ def test_load_build_info_release(): repositories=["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], platforms=["linux/arm64", "linux/amd64"], dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile", + skip_if_exists=True, olm_tag=True, sign=True, ), From c6642c4042b64782dd90975ca851e69124cf3792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 12:17:15 +0200 Subject: [PATCH 05/21] Fixes --- .evergreen-functions.yml | 2 ++ .evergreen-release.yml | 2 ++ scripts/dev/contexts/evg-private-context | 4 +--- scripts/dev/contexts/root-context | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index 64e77bd30..054454736 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -46,6 +46,8 @@ variables: - RELEASE_INITIAL_VERSION - RELEASE_INITIAL_COMMIT_SHA - OPERATOR_VERSION + - READINESS_PROBE_VERSION + - VERSION_UPGRADE_HOOK_VERSION - BUILD_SCENARIO functions: diff --git a/.evergreen-release.yml b/.evergreen-release.yml index d5e822bfb..56a24e274 100644 --- a/.evergreen-release.yml +++ b/.evergreen-release.yml @@ -139,6 +139,8 @@ buildvariants: - name: release_init_database - name: release_init_ops_manager - name: release_database + - name: release_readiness_probe + - name: release_version_upgrade_hook - name: preflight_release_images display_name: preflight_release_images diff --git a/scripts/dev/contexts/evg-private-context b/scripts/dev/contexts/evg-private-context index c0b243dda..2157a716e 100644 --- a/scripts/dev/contexts/evg-private-context +++ b/scripts/dev/contexts/evg-private-context @@ -151,6 +151,4 @@ case $BUILD_SCENARIO in exit 1 ;; esac -echo "Setting REGISTRY=${REGISTRY} and OPERATOR_VERSION=${OPERATOR_VERSION} for ${BUILD_SCENARIO} build scenario" -export OPERATOR_VERSION="${OPERATOR_VERSION}" -export REGISTRY="${REGISTRY}" +echo "Setting REGISTRY=${REGISTRY} and OPERATOR_VERSION=${OPERATOR_VERSION}, READINESS_PROBE_VERSION=${READINESS_PROBE_VERSION}, VERSION_UPGRADE_HOOK_VERSION=${VERSION_UPGRADE_HOOK_VERSION} for ${BUILD_SCENARIO} build scenario" diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index d2a1bcc43..ca69ced09 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -50,6 +50,7 @@ OPERATOR_VERSION=${OPERATOR_VERSION:-"latest"} READINESS_PROBE_VERSION=${READINESS_PROBE_VERSION:-"latest"} VERSION_UPGRADE_HOOK_VERSION=${VERSION_UPGRADE_HOOK_VERSION:-"latest"} if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then + echo "Overriding all versions with ${OVERRIDE_VERSION_ID}" OPERATOR_VERSION="${OVERRIDE_VERSION_ID}" READINESS_PROBE_VERSION="${OVERRIDE_VERSION_ID}" VERSION_UPGRADE_HOOK_VERSION="${OVERRIDE_VERSION_ID}" @@ -65,6 +66,7 @@ export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION}" ### Registries and images export QUAY_REGISTRY="quay.io/mongodb" +export REGISTRY=${REGISTRY} export OPERATOR_REGISTRY=${REGISTRY} export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} From 6270674be28596a7071e4acddecf8362de2a8ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 12:55:01 +0200 Subject: [PATCH 06/21] Fixes --- scripts/dev/contexts/root-context | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index ca69ced09..3006a0e31 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -50,10 +50,8 @@ OPERATOR_VERSION=${OPERATOR_VERSION:-"latest"} READINESS_PROBE_VERSION=${READINESS_PROBE_VERSION:-"latest"} VERSION_UPGRADE_HOOK_VERSION=${VERSION_UPGRADE_HOOK_VERSION:-"latest"} if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then - echo "Overriding all versions with ${OVERRIDE_VERSION_ID}" + echo "Overriding operator version with ${OVERRIDE_VERSION_ID}" OPERATOR_VERSION="${OVERRIDE_VERSION_ID}" - READINESS_PROBE_VERSION="${OVERRIDE_VERSION_ID}" - VERSION_UPGRADE_HOOK_VERSION="${OVERRIDE_VERSION_ID}" fi export OPERATOR_VERSION="${OPERATOR_VERSION}" @@ -68,7 +66,7 @@ export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION}" export QUAY_REGISTRY="quay.io/mongodb" export REGISTRY=${REGISTRY} export OPERATOR_REGISTRY=${REGISTRY} -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} +export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-$REGISTRY} # Specific registries for different images, can be overridden if needed export INIT_APPDB_REGISTRY=${INIT_IMAGES_REGISTRY} @@ -86,10 +84,12 @@ export MDB_AGENT_IMAGE_REPOSITORY="${MDB_AGENT_REGISTRY}/mongodb-agent" export MONGODB_REPO_URL="${QUAY_REGISTRY}" export MEKO_TESTS_REGISTRY=${REGISTRY} export MEKO_TESTS_IMAGE_REPOSITORY="${MEKO_TESTS_REGISTRY}/mongodb-kubernetes-tests" +export READINESS_PROBE_REGISTRY=${READINESS_PROBE_REGISTRY:-$REGISTRY} +export VERSION_UPGRADE_HOOK_REGISTRY=${VERSION_UPGRADE_HOOK_REGISTRY:-$REGISTRY} export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" -export READINESS_PROBE_IMAGE="${REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" -export VERSION_UPGRADE_HOOK_IMAGE="${REGISTRY}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${VERSION_UPGRADE_HOOK_VERSION}" +export READINESS_PROBE_IMAGE="${READINESS_PROBE_REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_IMAGE="${VERSION_UPGRADE_HOOK_REGISTRY}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${VERSION_UPGRADE_HOOK_VERSION}" export KUBE_ENVIRONMENT_NAME=kind From ea0e23a5a14c6245c5732908ed93b00e89018915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 12:58:46 +0200 Subject: [PATCH 07/21] Fix missing overrides for repositories --- scripts/dev/contexts/root-context | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index d2a1bcc43..b7a3b4629 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -56,33 +56,33 @@ if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then fi export OPERATOR_VERSION="${OPERATOR_VERSION}" -export INIT_APPDB_VERSION="${OPERATOR_VERSION}" -export INIT_DATABASE_VERSION="${OPERATOR_VERSION}" -export INIT_OPS_MANAGER_VERSION="${OPERATOR_VERSION}" -export DATABASE_VERSION="${OPERATOR_VERSION}" -export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION}" -export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION}" +export INIT_APPDB_VERSION="${INIT_APPDB_VERSION:-$OPERATOR_VERSION}" +export INIT_DATABASE_VERSION="${INIT_DATABASE_VERSION:-$OPERATOR_VERSION}" +export INIT_OPS_MANAGER_VERSION="${INIT_OPS_MANAGER_VERSION:-$OPERATOR_VERSION}" +export DATABASE_VERSION="${DATABASE_VERSION:-$OPERATOR_VERSION}" +export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$VERSION_UPGRADE_HOOK_VERSION}" ### Registries and images export QUAY_REGISTRY="quay.io/mongodb" -export OPERATOR_REGISTRY=${REGISTRY} -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} +export OPERATOR_REGISTRY=${OPERATOR_REGISTRY:-$REGISTRY} +export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-$REGISTRY} # Specific registries for different images, can be overridden if needed -export INIT_APPDB_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_APPDB_REGISTRY=${INIT_APPDB_REGISTRY:-$INIT_IMAGES_REGISTRY} export INIT_APPDB_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-appdb" -export INIT_OPS_MANAGER_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_OPS_MANAGER_REGISTRY=${INIT_OPS_MANAGER_REGISTRY:-$INIT_IMAGES_REGISTRY} export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-ops-manager" -export INIT_DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} +export INIT_DATABASE_REGISTRY=${INIT_DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-database" -export DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} +export DATABASE_REGISTRY=${DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} export MONGODB_ENTERPRISE_DATABASE_IMAGE="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-database" -export OPS_MANAGER_REGISTRY=${REGISTRY} +export OPS_MANAGER_REGISTRY=${OPS_MANAGER_REGISTRY:-$REGISTRY} export OPS_MANAGER_IMAGE_REPOSITORY="${OPS_MANAGER_REGISTRY}/mongodb-enterprise-ops-manager-ubi" -export MDB_AGENT_REGISTRY=${REGISTRY} +export MDB_AGENT_REGISTRY=${MDB_AGENT_REGISTRY:-$REGISTRY} export MDB_AGENT_IMAGE_REPOSITORY="${MDB_AGENT_REGISTRY}/mongodb-agent" -export MONGODB_REPO_URL="${QUAY_REGISTRY}" -export MEKO_TESTS_REGISTRY=${REGISTRY} +export MONGODB_REPO_URL="${MONGODB_REPO_URL:-$QUAY_REGISTRY}" +export MEKO_TESTS_REGISTRY=${MEKO_TESTS_REGISTRY:-$REGISTRY} export MEKO_TESTS_IMAGE_REPOSITORY="${MEKO_TESTS_REGISTRY}/mongodb-kubernetes-tests" export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" From f61dba9b70ae4e0f823b335b04a42ae48fe7670b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 12:58:46 +0200 Subject: [PATCH 08/21] Fix missing overrides for repositories --- scripts/dev/contexts/root-context | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index d2a1bcc43..1a3f22e79 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -56,38 +56,40 @@ if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then fi export OPERATOR_VERSION="${OPERATOR_VERSION}" -export INIT_APPDB_VERSION="${OPERATOR_VERSION}" -export INIT_DATABASE_VERSION="${OPERATOR_VERSION}" -export INIT_OPS_MANAGER_VERSION="${OPERATOR_VERSION}" -export DATABASE_VERSION="${OPERATOR_VERSION}" -export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION}" -export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION}" +export INIT_APPDB_VERSION="${INIT_APPDB_VERSION:-$OPERATOR_VERSION}" +export INIT_DATABASE_VERSION="${INIT_DATABASE_VERSION:-$OPERATOR_VERSION}" +export INIT_OPS_MANAGER_VERSION="${INIT_OPS_MANAGER_VERSION:-$OPERATOR_VERSION}" +export DATABASE_VERSION="${DATABASE_VERSION:-$OPERATOR_VERSION}" +export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-$READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-$VERSION_UPGRADE_HOOK_VERSION}" ### Registries and images export QUAY_REGISTRY="quay.io/mongodb" -export OPERATOR_REGISTRY=${REGISTRY} -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} +export OPERATOR_REGISTRY=${OPERATOR_REGISTRY:-$REGISTRY} +export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-$REGISTRY} # Specific registries for different images, can be overridden if needed -export INIT_APPDB_REGISTRY=${INIT_IMAGES_REGISTRY} -export INIT_APPDB_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-appdb" -export INIT_OPS_MANAGER_REGISTRY=${INIT_IMAGES_REGISTRY} -export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-ops-manager" -export INIT_DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} -export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-init-database" -export DATABASE_REGISTRY=${INIT_IMAGES_REGISTRY} -export MONGODB_ENTERPRISE_DATABASE_IMAGE="${INIT_IMAGES_REGISTRY}/mongodb-kubernetes-database" -export OPS_MANAGER_REGISTRY=${REGISTRY} +export INIT_APPDB_REGISTRY=${INIT_APPDB_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_APPDB_IMAGE_REPOSITORY="${INIT_APPDB_REGISTRY}/mongodb-kubernetes-init-appdb" +export INIT_OPS_MANAGER_REGISTRY=${INIT_OPS_MANAGER_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_OPS_MANAGER_REGISTRY}/mongodb-kubernetes-init-ops-manager" +export INIT_DATABASE_REGISTRY=${INIT_DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_DATABASE_REGISTRY}/mongodb-kubernetes-init-database" +export DATABASE_REGISTRY=${DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} +export MONGODB_ENTERPRISE_DATABASE_IMAGE="${DATABASE_REGISTRY}/mongodb-kubernetes-database" +export OPS_MANAGER_REGISTRY=${OPS_MANAGER_REGISTRY:-$REGISTRY} export OPS_MANAGER_IMAGE_REPOSITORY="${OPS_MANAGER_REGISTRY}/mongodb-enterprise-ops-manager-ubi" -export MDB_AGENT_REGISTRY=${REGISTRY} +export MDB_AGENT_REGISTRY=${MDB_AGENT_REGISTRY:-$REGISTRY} export MDB_AGENT_IMAGE_REPOSITORY="${MDB_AGENT_REGISTRY}/mongodb-agent" -export MONGODB_REPO_URL="${QUAY_REGISTRY}" -export MEKO_TESTS_REGISTRY=${REGISTRY} +export MONGODB_REPO_URL="${MONGODB_REPO_URL:-$QUAY_REGISTRY}" +export MEKO_TESTS_REGISTRY=${MEKO_TESTS_REGISTRY:-$REGISTRY} export MEKO_TESTS_IMAGE_REPOSITORY="${MEKO_TESTS_REGISTRY}/mongodb-kubernetes-tests" +export READINESS_PROBE_REGISTRY=${READINESS_PROBE_REGISTRY:-$REGISTRY} +export VERSION_UPGRADE_HOOK_REGISTRY=${VERSION_UPGRADE_HOOK_REGISTRY:-$REGISTRY} export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" -export READINESS_PROBE_IMAGE="${REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" -export VERSION_UPGRADE_HOOK_IMAGE="${REGISTRY}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${VERSION_UPGRADE_HOOK_VERSION}" +export READINESS_PROBE_IMAGE="${READINESS_PROBE_REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" +export VERSION_UPGRADE_HOOK_IMAGE="${VERSION_UPGRADE_HOOK_REGISTRY}/mongodb-kubernetes-operator-version-upgrade-post-start-hook:${VERSION_UPGRADE_HOOK_VERSION}" export KUBE_ENVIRONMENT_NAME=kind From 1a86a47f65d415f40240ceb989440845775cf090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 13:59:09 +0200 Subject: [PATCH 09/21] Moved `mco/config/samples` files to `public/samples/community/` --- .../mongodb.com_v1_custom_volume_cr.yaml | 0 .../mongodb.com_v1_hostpath.yaml | 0 .../mongodb.com_v1_metadata.yaml | 0 .../samples/community}/external_access/agent-certificate.yaml | 0 .../community}/external_access/cert-manager-certificate.yaml | 0 .../samples/community}/external_access/cert-manager-issuer.yaml | 0 .../samples/community}/external_access/cert-x509.yaml | 0 .../samples/community}/external_access/external_services.yaml | 0 .../external_access/mongodb.com_v1_mongodbcommunity_cr.yaml | 0 ...1_mongodbcommunity_additional_connection_string_options.yaml | 0 ...odb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml | 0 ..._v1_mongodbcommunity_connection_string_secret_namespace.yaml | 0 .../samples/community/mongodb.com_v1_mongodbcommunity_cr.yaml | 2 +- .../mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml | 0 .../community}/mongodb.com_v1_mongodbcommunity_custom_role.yaml | 0 .../mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml | 0 .../mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml | 0 .../mongodb.com_v1_mongodbcommunity_openshift_cr.yaml | 0 .../mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml | 0 .../community}/mongodb.com_v1_mongodbcommunity_prometheus.yaml | 0 .../mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml | 0 .../mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml | 0 .../community}/mongodb.com_v1_mongodbcommunity_tls_cr.yaml | 0 .../community}/mongodb.com_v1_mongodbcommunity_x509.yaml | 0 24 files changed, 1 insertion(+), 1 deletion(-) rename {mongodb-community-operator/config/samples => public/samples/community}/arbitrary_statefulset_configuration/mongodb.com_v1_custom_volume_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/arbitrary_statefulset_configuration/mongodb.com_v1_hostpath.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/arbitrary_statefulset_configuration/mongodb.com_v1_metadata.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/agent-certificate.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/cert-manager-certificate.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/cert-manager-issuer.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/cert-x509.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/external_services.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/external_access/mongodb.com_v1_mongodbcommunity_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_additional_connection_string_options.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_connection_string_secret_namespace.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_custom_role.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_openshift_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_prometheus.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_tls_cr.yaml (100%) rename {mongodb-community-operator/config/samples => public/samples/community}/mongodb.com_v1_mongodbcommunity_x509.yaml (100%) diff --git a/mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_custom_volume_cr.yaml b/public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_custom_volume_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_custom_volume_cr.yaml rename to public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_custom_volume_cr.yaml diff --git a/mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_hostpath.yaml b/public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_hostpath.yaml similarity index 100% rename from mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_hostpath.yaml rename to public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_hostpath.yaml diff --git a/mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_metadata.yaml b/public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_metadata.yaml similarity index 100% rename from mongodb-community-operator/config/samples/arbitrary_statefulset_configuration/mongodb.com_v1_metadata.yaml rename to public/samples/community/arbitrary_statefulset_configuration/mongodb.com_v1_metadata.yaml diff --git a/mongodb-community-operator/config/samples/external_access/agent-certificate.yaml b/public/samples/community/external_access/agent-certificate.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/agent-certificate.yaml rename to public/samples/community/external_access/agent-certificate.yaml diff --git a/mongodb-community-operator/config/samples/external_access/cert-manager-certificate.yaml b/public/samples/community/external_access/cert-manager-certificate.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/cert-manager-certificate.yaml rename to public/samples/community/external_access/cert-manager-certificate.yaml diff --git a/mongodb-community-operator/config/samples/external_access/cert-manager-issuer.yaml b/public/samples/community/external_access/cert-manager-issuer.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/cert-manager-issuer.yaml rename to public/samples/community/external_access/cert-manager-issuer.yaml diff --git a/mongodb-community-operator/config/samples/external_access/cert-x509.yaml b/public/samples/community/external_access/cert-x509.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/cert-x509.yaml rename to public/samples/community/external_access/cert-x509.yaml diff --git a/mongodb-community-operator/config/samples/external_access/external_services.yaml b/public/samples/community/external_access/external_services.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/external_services.yaml rename to public/samples/community/external_access/external_services.yaml diff --git a/mongodb-community-operator/config/samples/external_access/mongodb.com_v1_mongodbcommunity_cr.yaml b/public/samples/community/external_access/mongodb.com_v1_mongodbcommunity_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/external_access/mongodb.com_v1_mongodbcommunity_cr.yaml rename to public/samples/community/external_access/mongodb.com_v1_mongodbcommunity_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_additional_connection_string_options.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_additional_connection_string_options.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_additional_connection_string_options.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_additional_connection_string_options.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_additional_mongod_config_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_connection_string_secret_namespace.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_connection_string_secret_namespace.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_connection_string_secret_namespace.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_connection_string_secret_namespace.yaml diff --git a/public/samples/community/mongodb.com_v1_mongodbcommunity_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_cr.yaml index 65d8e68c1..89fe86096 100644 --- a/public/samples/community/mongodb.com_v1_mongodbcommunity_cr.yaml +++ b/public/samples/community/mongodb.com_v1_mongodbcommunity_cr.yaml @@ -33,4 +33,4 @@ metadata: name: my-user-password type: Opaque stringData: - password: test123 + password: diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_cr_podantiaffinity.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_custom_role.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_custom_role.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_custom_role.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_custom_role.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_disabled_process_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_ignore_unkown_users_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_openshift_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_openshift_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_openshift_cr.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_openshift_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_override_ac_setting.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_prometheus.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_prometheus.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_prometheus.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_prometheus.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_readiness_probe_values.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_specify_pod_resources.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_tls_cr.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_tls_cr.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_tls_cr.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_tls_cr.yaml diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_x509.yaml b/public/samples/community/mongodb.com_v1_mongodbcommunity_x509.yaml similarity index 100% rename from mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_x509.yaml rename to public/samples/community/mongodb.com_v1_mongodbcommunity_x509.yaml From febadb99702bab0299c95d2d4f78ef17c3873a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 13:59:28 +0200 Subject: [PATCH 10/21] Deleted all other files in `mco/config/` (unused) --- ...ommunity.mongodb.com_mongodbcommunity.yaml | 672 ------------------ .../config/crd/kustomization.yaml | 10 - .../config/crd/kustomizeconfig.yaml | 19 - .../config/default/kustomization.yaml | 6 - .../config/local_run/kustomization.yaml | 6 - .../config/manager/kustomization.yaml | 11 - .../config/manager/manager.yaml | 74 -- .../config/rbac/kustomization.yaml | 7 - .../config/rbac/role.yaml | 46 -- .../config/rbac/role_binding.yaml | 11 - .../config/rbac/role_binding_database.yaml | 11 - .../config/rbac/role_database.yaml | 19 - .../config/rbac/service_account.yaml | 4 - .../config/rbac/service_account_database.yaml | 4 - .../mongodb.com_v1_mongodbcommunity_cr.yaml | 36 - 15 files changed, 936 deletions(-) delete mode 100644 mongodb-community-operator/config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml delete mode 100644 mongodb-community-operator/config/crd/kustomization.yaml delete mode 100644 mongodb-community-operator/config/crd/kustomizeconfig.yaml delete mode 100644 mongodb-community-operator/config/default/kustomization.yaml delete mode 100644 mongodb-community-operator/config/local_run/kustomization.yaml delete mode 100644 mongodb-community-operator/config/manager/kustomization.yaml delete mode 100644 mongodb-community-operator/config/manager/manager.yaml delete mode 100644 mongodb-community-operator/config/rbac/kustomization.yaml delete mode 100644 mongodb-community-operator/config/rbac/role.yaml delete mode 100644 mongodb-community-operator/config/rbac/role_binding.yaml delete mode 100644 mongodb-community-operator/config/rbac/role_binding_database.yaml delete mode 100644 mongodb-community-operator/config/rbac/role_database.yaml delete mode 100644 mongodb-community-operator/config/rbac/service_account.yaml delete mode 100644 mongodb-community-operator/config/rbac/service_account_database.yaml delete mode 100644 mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr.yaml diff --git a/mongodb-community-operator/config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml b/mongodb-community-operator/config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml deleted file mode 100644 index 42c2258d0..000000000 --- a/mongodb-community-operator/config/crd/bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml +++ /dev/null @@ -1,672 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.15.0 - service.binding: path={.metadata.name}-{.spec.users[0].db}-{.spec.users[0].name},objectType=Secret - service.binding/connectionString: path={.metadata.name}-{.spec.users[0].db}-{.spec.users[0].name},objectType=Secret,sourceKey=connectionString.standardSrv - service.binding/password: path={.metadata.name}-{.spec.users[0].db}-{.spec.users[0].name},objectType=Secret,sourceKey=password - service.binding/provider: community - service.binding/type: mongodb - service.binding/username: path={.metadata.name}-{.spec.users[0].db}-{.spec.users[0].name},objectType=Secret,sourceKey=username - name: mongodbcommunity.mongodbcommunity.mongodb.com -spec: - group: mongodbcommunity.mongodb.com - names: - kind: MongoDBCommunity - listKind: MongoDBCommunityList - plural: mongodbcommunity - shortNames: - - mdbc - singular: mongodbcommunity - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: Current state of the MongoDB deployment - jsonPath: .status.phase - name: Phase - type: string - - description: Version of MongoDB server - jsonPath: .status.version - name: Version - type: string - name: v1 - schema: - openAPIV3Schema: - description: MongoDBCommunity is the Schema for the mongodbs API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: MongoDBCommunitySpec defines the desired state of MongoDB - properties: - additionalConnectionStringConfig: - description: Additional options to be appended to the connection string. - These options apply to the entire resource and to each user. - nullable: true - type: object - x-kubernetes-preserve-unknown-fields: true - additionalMongodConfig: - description: |- - AdditionalMongodConfig is additional configuration that can be passed to - each data-bearing mongod at runtime. Uses the same structure as the mongod - configuration file: https://www.mongodb.com/docs/manual/reference/configuration-options/ - nullable: true - type: object - x-kubernetes-preserve-unknown-fields: true - agent: - description: AgentConfiguration sets options for the MongoDB automation - agent - properties: - auditLogRotate: - description: AuditLogRotate if enabled, will enable AuditLogRotate - for all processes. - properties: - includeAuditLogsWithMongoDBLogs: - description: |- - set to 'true' to have the Automation Agent rotate the audit files along - with mongodb log files - type: boolean - numTotal: - description: maximum number of log files to have total - type: integer - numUncompressed: - description: maximum number of log files to leave uncompressed - type: integer - percentOfDiskspace: - description: |- - Maximum percentage of the total disk space these log files should take up. - The string needs to be able to be converted to float64 - type: string - sizeThresholdMB: - description: |- - Maximum size for an individual log file before rotation. - The string needs to be able to be converted to float64. - Fractional values of MB are supported. - type: string - timeThresholdHrs: - description: maximum hours for an individual log file before - rotation - type: integer - required: - - sizeThresholdMB - - timeThresholdHrs - type: object - logFile: - type: string - logLevel: - type: string - logRotate: - description: LogRotate if enabled, will enable LogRotate for all - processes. - properties: - includeAuditLogsWithMongoDBLogs: - description: |- - set to 'true' to have the Automation Agent rotate the audit files along - with mongodb log files - type: boolean - numTotal: - description: maximum number of log files to have total - type: integer - numUncompressed: - description: maximum number of log files to leave uncompressed - type: integer - percentOfDiskspace: - description: |- - Maximum percentage of the total disk space these log files should take up. - The string needs to be able to be converted to float64 - type: string - sizeThresholdMB: - description: |- - Maximum size for an individual log file before rotation. - The string needs to be able to be converted to float64. - Fractional values of MB are supported. - type: string - timeThresholdHrs: - description: maximum hours for an individual log file before - rotation - type: integer - required: - - sizeThresholdMB - - timeThresholdHrs - type: object - maxLogFileDurationHours: - type: integer - systemLog: - description: SystemLog configures system log of mongod - properties: - destination: - type: string - logAppend: - type: boolean - path: - type: string - required: - - destination - - logAppend - - path - type: object - type: object - arbiters: - description: |- - Arbiters is the number of arbiters to add to the Replica Set. - It is not recommended to have more than one arbiter per Replica Set. - More info: https://www.mongodb.com/docs/manual/tutorial/add-replica-set-arbiter/ - type: integer - automationConfig: - description: |- - AutomationConfigOverride is merged on top of the operator created automation config. Processes are merged - by name. Currently Only the process.disabled field is supported. - properties: - processes: - items: - description: OverrideProcess contains fields that we can override - on the AutomationConfig processes. - properties: - disabled: - type: boolean - logRotate: - description: CrdLogRotate is the crd definition of LogRotate - including fields in strings while the agent supports them - as float64 - properties: - includeAuditLogsWithMongoDBLogs: - description: |- - set to 'true' to have the Automation Agent rotate the audit files along - with mongodb log files - type: boolean - numTotal: - description: maximum number of log files to have total - type: integer - numUncompressed: - description: maximum number of log files to leave uncompressed - type: integer - percentOfDiskspace: - description: |- - Maximum percentage of the total disk space these log files should take up. - The string needs to be able to be converted to float64 - type: string - sizeThresholdMB: - description: |- - Maximum size for an individual log file before rotation. - The string needs to be able to be converted to float64. - Fractional values of MB are supported. - type: string - timeThresholdHrs: - description: maximum hours for an individual log file - before rotation - type: integer - required: - - sizeThresholdMB - - timeThresholdHrs - type: object - name: - type: string - required: - - disabled - - name - type: object - type: array - replicaSet: - properties: - settings: - description: |- - MapWrapper is a wrapper for a map to be used by other structs. - The CRD generator does not support map[string]interface{} - on the top level and hence we need to work around this with - a wrapping struct. - type: object - x-kubernetes-preserve-unknown-fields: true - type: object - type: object - featureCompatibilityVersion: - description: |- - FeatureCompatibilityVersion configures the feature compatibility version that will - be set for the deployment - type: string - memberConfig: - description: MemberConfig - items: - properties: - priority: - type: string - tags: - additionalProperties: - type: string - type: object - votes: - type: integer - type: object - type: array - members: - description: Members is the number of members in the replica set - type: integer - prometheus: - description: Prometheus configurations. - properties: - metricsPath: - description: Indicates path to the metrics endpoint. - pattern: ^\/[a-z0-9]+$ - type: string - passwordSecretRef: - description: Name of a Secret containing a HTTP Basic Auth Password. - properties: - key: - description: Key is the key in the secret storing this password. - Defaults to "password" - type: string - name: - description: Name is the name of the secret storing this user's - password - type: string - required: - - name - type: object - port: - description: Port where metrics endpoint will bind to. Defaults - to 9216. - type: integer - tlsSecretKeyRef: - description: |- - Name of a Secret (type kubernetes.io/tls) holding the certificates to use in the - Prometheus endpoint. - properties: - key: - description: Key is the key in the secret storing this password. - Defaults to "password" - type: string - name: - description: Name is the name of the secret storing this user's - password - type: string - required: - - name - type: object - username: - description: HTTP Basic Auth Username for metrics endpoint. - type: string - required: - - passwordSecretRef - - username - type: object - replicaSetHorizons: - description: |- - ReplicaSetHorizons Add this parameter and values if you need your database - to be accessed outside of Kubernetes. This setting allows you to - provide different DNS settings within the Kubernetes cluster and - to the Kubernetes cluster. The Kubernetes Operator uses split horizon - DNS for replica set members. This feature allows communication both - within the Kubernetes cluster and from outside Kubernetes. - items: - additionalProperties: - type: string - type: object - type: array - security: - description: Security configures security features, such as TLS, and - authentication settings for a deployment - properties: - authentication: - properties: - agentCertificateSecretRef: - description: |- - AgentCertificateSecret is a reference to a Secret containing the certificate and the key for the automation agent - The secret needs to have available: - - certificate under key: "tls.crt" - - private key under key: "tls.key" - If additionally, tls.pem is present, then it needs to be equal to the concatenation of tls.crt and tls.key - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. - type: string - type: object - x-kubernetes-map-type: atomic - agentMode: - description: AgentMode contains the authentication mode used - by the automation agent. - enum: - - SCRAM - - SCRAM-SHA-256 - - SCRAM-SHA-1 - - X509 - type: string - ignoreUnknownUsers: - default: true - nullable: true - type: boolean - modes: - description: Modes is an array specifying which authentication - methods should be enabled. - items: - enum: - - SCRAM - - SCRAM-SHA-256 - - SCRAM-SHA-1 - - X509 - type: string - type: array - required: - - modes - type: object - roles: - description: User-specified custom MongoDB roles that should be - configured in the deployment. - items: - description: CustomRole defines a custom MongoDB role. - properties: - authenticationRestrictions: - description: The authentication restrictions the server - enforces on the role. - items: - description: |- - AuthenticationRestriction specifies a list of IP addresses and CIDR ranges users - are allowed to connect to or from. - properties: - clientSource: - items: - type: string - type: array - serverAddress: - items: - type: string - type: array - required: - - clientSource - - serverAddress - type: object - type: array - db: - description: The database of the role. - type: string - privileges: - description: The privileges to grant the role. - items: - description: Privilege defines the actions a role is allowed - to perform on a given resource. - properties: - actions: - items: - type: string - type: array - resource: - description: |- - Resource specifies specifies the resources upon which a privilege permits actions. - See https://www.mongodb.com/docs/manual/reference/resource-document for more. - properties: - anyResource: - type: boolean - cluster: - type: boolean - collection: - type: string - db: - type: string - type: object - required: - - actions - - resource - type: object - type: array - role: - description: The name of the role. - type: string - roles: - description: An array of roles from which this role inherits - privileges. - items: - description: Role is the database role this user should - have - properties: - db: - description: DB is the database the role can act on - type: string - name: - description: Name is the name of the role - type: string - required: - - db - - name - type: object - type: array - required: - - db - - privileges - - role - type: object - type: array - tls: - description: TLS configuration for both client-server and server-server - communication - properties: - caCertificateSecretRef: - description: |- - CaCertificateSecret is a reference to a Secret containing the certificate for the CA which signed the server certificates - The certificate is expected to be available under the key "ca.crt" - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. - type: string - type: object - x-kubernetes-map-type: atomic - caConfigMapRef: - description: |- - CaConfigMap is a reference to a ConfigMap containing the certificate for the CA which signed the server certificates - The certificate is expected to be available under the key "ca.crt" - This field is ignored when CaCertificateSecretRef is configured - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. - type: string - type: object - x-kubernetes-map-type: atomic - certificateKeySecretRef: - description: |- - CertificateKeySecret is a reference to a Secret containing a private key and certificate to use for TLS. - The key and cert are expected to be PEM encoded and available at "tls.key" and "tls.crt". - This is the same format used for the standard "kubernetes.io/tls" Secret type, but no specific type is required. - Alternatively, an entry tls.pem, containing the concatenation of cert and key, can be provided. - If all of tls.pem, tls.crt and tls.key are present, the tls.pem one needs to be equal to the concatenation of tls.crt and tls.key - properties: - name: - default: "" - description: |- - Name of the referent. - This field is effectively required, but due to backwards compatibility is - allowed to be empty. Instances of this type with an empty value here are - almost certainly wrong. - TODO: Add other useful fields. apiVersion, kind, uid? - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. - type: string - type: object - x-kubernetes-map-type: atomic - enabled: - type: boolean - optional: - description: Optional configures if TLS should be required - or optional for connections - type: boolean - required: - - enabled - type: object - type: object - statefulSet: - description: |- - StatefulSetConfiguration holds the optional custom StatefulSet - that should be merged into the operator created one. - properties: - metadata: - description: StatefulSetMetadataWrapper is a wrapper around Labels - and Annotations - properties: - annotations: - additionalProperties: - type: string - type: object - labels: - additionalProperties: - type: string - type: object - type: object - spec: - type: object - x-kubernetes-preserve-unknown-fields: true - required: - - spec - type: object - type: - description: Type defines which type of MongoDB deployment the resource - should create - enum: - - ReplicaSet - type: string - users: - description: Users specifies the MongoDB users that should be configured - in your deployment - items: - properties: - additionalConnectionStringConfig: - description: |- - Additional options to be appended to the connection string. - These options apply only to this user and will override any existing options in the resource. - nullable: true - type: object - x-kubernetes-preserve-unknown-fields: true - connectionStringSecretName: - description: |- - ConnectionStringSecretName is the name of the secret object created by the operator which exposes the connection strings for the user. - If provided, this secret must be different for each user in a deployment. - type: string - connectionStringSecretNamespace: - description: ConnectionStringSecretNamespace is the namespace - of the secret object created by the operator which exposes - the connection strings for the user. - type: string - db: - default: admin - description: DB is the database the user is stored in. Defaults - to "admin" - type: string - name: - description: Name is the username of the user - type: string - passwordSecretRef: - description: PasswordSecretRef is a reference to the secret - containing this user's password - properties: - key: - description: Key is the key in the secret storing this password. - Defaults to "password" - type: string - name: - description: Name is the name of the secret storing this - user's password - type: string - required: - - name - type: object - roles: - description: Roles is an array of roles assigned to this user - items: - description: Role is the database role this user should have - properties: - db: - description: DB is the database the role can act on - type: string - name: - description: Name is the name of the role - type: string - required: - - db - - name - type: object - type: array - scramCredentialsSecretName: - description: |- - ScramCredentialsSecretName appended by string "scram-credentials" is the name of the secret object created by the mongoDB operator for storing SCRAM credentials - These secrets names must be different for each user in a deployment. - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - name - - roles - type: object - type: array - version: - description: Version defines which version of MongoDB will be used - type: string - required: - - security - - type - - users - type: object - status: - description: MongoDBCommunityStatus defines the observed state of MongoDB - properties: - currentMongoDBArbiters: - type: integer - currentMongoDBMembers: - type: integer - currentStatefulSetArbitersReplicas: - type: integer - currentStatefulSetReplicas: - type: integer - message: - type: string - mongoUri: - type: string - phase: - type: string - version: - type: string - required: - - currentMongoDBMembers - - currentStatefulSetReplicas - - mongoUri - - phase - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/mongodb-community-operator/config/crd/kustomization.yaml b/mongodb-community-operator/config/crd/kustomization.yaml deleted file mode 100644 index 25eecc05f..000000000 --- a/mongodb-community-operator/config/crd/kustomization.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# This kustomization.yaml is not intended to be run by itself, -# since it depends on service name and namespace that are out of this kustomize package. -# It should be run by config/default -resources: -- bases/mongodbcommunity.mongodb.com_mongodbcommunity.yaml -# +kubebuilder:scaffold:crdkustomizeresource - -# the following config is for teaching kustomize how to do kustomization for CRDs. -configurations: -- kustomizeconfig.yaml diff --git a/mongodb-community-operator/config/crd/kustomizeconfig.yaml b/mongodb-community-operator/config/crd/kustomizeconfig.yaml deleted file mode 100644 index ec5c150a9..000000000 --- a/mongodb-community-operator/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/mongodb-community-operator/config/default/kustomization.yaml b/mongodb-community-operator/config/default/kustomization.yaml deleted file mode 100644 index bd972fd91..000000000 --- a/mongodb-community-operator/config/default/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -namePrefix: "" - -resources: - - ../crd - - ../rbac - - ../manager diff --git a/mongodb-community-operator/config/local_run/kustomization.yaml b/mongodb-community-operator/config/local_run/kustomization.yaml deleted file mode 100644 index 0a33b94d2..000000000 --- a/mongodb-community-operator/config/local_run/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# used to run the operator locally -namePrefix: "" - -resources: - - ../crd - - ../rbac diff --git a/mongodb-community-operator/config/manager/kustomization.yaml b/mongodb-community-operator/config/manager/kustomization.yaml deleted file mode 100644 index cb74a8d0e..000000000 --- a/mongodb-community-operator/config/manager/kustomization.yaml +++ /dev/null @@ -1,11 +0,0 @@ -resources: -- manager.yaml - -generatorOptions: - disableNameSuffixHash: true - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -images: -- name: mongodb-kubernetes-operator - newName: quay.io/mongodb/mongodb-kubernetes-operator:0.5.0 diff --git a/mongodb-community-operator/config/manager/manager.yaml b/mongodb-community-operator/config/manager/manager.yaml deleted file mode 100644 index 4f64da811..000000000 --- a/mongodb-community-operator/config/manager/manager.yaml +++ /dev/null @@ -1,74 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - email: support@mongodb.com - labels: - owner: mongodb - name: mongodb-kubernetes-operator -spec: - replicas: 1 - selector: - matchLabels: - name: mongodb-kubernetes-operator - strategy: - rollingUpdate: - maxUnavailable: 1 - type: RollingUpdate - template: - metadata: - labels: - name: mongodb-kubernetes-operator - spec: - affinity: - podAntiAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - - labelSelector: - matchExpressions: - - key: name - operator: In - values: - - mongodb-kubernetes-operator - topologyKey: kubernetes.io/hostname - containers: - - command: - - /usr/local/bin/entrypoint - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OPERATOR_NAME - value: mongodb-kubernetes-operator - - name: AGENT_IMAGE - value: quay.io/mongodb/mongodb-agent:108.0.2.8729-1 - - name: VERSION_UPGRADE_HOOK_IMAGE - value: quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.9 - - name: READINESS_PROBE_IMAGE - value: quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.22 - - name: MONGODB_IMAGE - value: mongodb-community-server - - name: MONGODB_REPO_URL - value: quay.io/mongodb - image: quay.io/mongodb/mongodb-kubernetes-operator:0.12.0 - imagePullPolicy: Always - name: mongodb-kubernetes-operator - resources: - limits: - cpu: 1100m - memory: 1Gi - requests: - cpu: 500m - memory: 200Mi - securityContext: - readOnlyRootFilesystem: true - runAsUser: 2000 - allowPrivilegeEscalation: false - securityContext: - seccompProfile: - type: RuntimeDefault - serviceAccountName: mongodb-kubernetes-operator diff --git a/mongodb-community-operator/config/rbac/kustomization.yaml b/mongodb-community-operator/config/rbac/kustomization.yaml deleted file mode 100644 index f1fe88a33..000000000 --- a/mongodb-community-operator/config/rbac/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resources: -- role.yaml -- role_binding.yaml -- service_account.yaml -- service_account_database.yaml -- role_binding_database.yaml -- role_database.yaml diff --git a/mongodb-community-operator/config/rbac/role.yaml b/mongodb-community-operator/config/rbac/role.yaml deleted file mode 100644 index 6a9c42070..000000000 --- a/mongodb-community-operator/config/rbac/role.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: mongodb-kubernetes-operator -rules: -- apiGroups: - - "" - resources: - - pods - - services - - configmaps - - secrets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - - statefulsets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - mongodbcommunity.mongodb.com - resources: - - mongodbcommunity - - mongodbcommunity/status - - mongodbcommunity/spec - - mongodbcommunity/finalizers - verbs: - - get - - patch - - list - - update - - watch diff --git a/mongodb-community-operator/config/rbac/role_binding.yaml b/mongodb-community-operator/config/rbac/role_binding.yaml deleted file mode 100644 index b444f2d67..000000000 --- a/mongodb-community-operator/config/rbac/role_binding.yaml +++ /dev/null @@ -1,11 +0,0 @@ -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: mongodb-kubernetes-operator -subjects: -- kind: ServiceAccount - name: mongodb-kubernetes-operator -roleRef: - kind: Role - name: mongodb-kubernetes-operator - apiGroup: rbac.authorization.k8s.io diff --git a/mongodb-community-operator/config/rbac/role_binding_database.yaml b/mongodb-community-operator/config/rbac/role_binding_database.yaml deleted file mode 100644 index b02a52db3..000000000 --- a/mongodb-community-operator/config/rbac/role_binding_database.yaml +++ /dev/null @@ -1,11 +0,0 @@ -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: mongodb-database -subjects: -- kind: ServiceAccount - name: mongodb-database -roleRef: - kind: Role - name: mongodb-database - apiGroup: rbac.authorization.k8s.io diff --git a/mongodb-community-operator/config/rbac/role_database.yaml b/mongodb-community-operator/config/rbac/role_database.yaml deleted file mode 100644 index eaeef740b..000000000 --- a/mongodb-community-operator/config/rbac/role_database.yaml +++ /dev/null @@ -1,19 +0,0 @@ -kind: Role -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: mongodb-database -rules: - - apiGroups: - - "" - resources: - - secrets - verbs: - - get - - apiGroups: - - "" - resources: - - pods - verbs: - - patch - - delete - - get diff --git a/mongodb-community-operator/config/rbac/service_account.yaml b/mongodb-community-operator/config/rbac/service_account.yaml deleted file mode 100644 index 2740f6caf..000000000 --- a/mongodb-community-operator/config/rbac/service_account.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: mongodb-kubernetes-operator diff --git a/mongodb-community-operator/config/rbac/service_account_database.yaml b/mongodb-community-operator/config/rbac/service_account_database.yaml deleted file mode 100644 index b24ae9d58..000000000 --- a/mongodb-community-operator/config/rbac/service_account_database.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: mongodb-database diff --git a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr.yaml b/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr.yaml deleted file mode 100644 index 89fe86096..000000000 --- a/mongodb-community-operator/config/samples/mongodb.com_v1_mongodbcommunity_cr.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -apiVersion: mongodbcommunity.mongodb.com/v1 -kind: MongoDBCommunity -metadata: - name: example-mongodb -spec: - members: 3 - type: ReplicaSet - version: "6.0.5" - security: - authentication: - modes: ["SCRAM"] - users: - - name: my-user - db: admin - passwordSecretRef: # a reference to the secret that will be used to generate the user's password - name: my-user-password - roles: - - name: clusterAdmin - db: admin - - name: userAdminAnyDatabase - db: admin - scramCredentialsSecretName: my-scram - additionalMongodConfig: - storage.wiredTiger.engineConfig.journalCompressor: zlib - -# the user credentials will be generated from this secret -# once the credentials are generated, this secret is no longer required ---- -apiVersion: v1 -kind: Secret -metadata: - name: my-user-password -type: Opaque -stringData: - password: From fade27a7988af784a4b17785f497e22f6b4efd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 14:00:07 +0200 Subject: [PATCH 11/21] Linter fixes --- scripts/dev/contexts/root-context | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index 1ed2b5e21..c48213549 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -52,37 +52,37 @@ if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then fi export OPERATOR_VERSION="${OPERATOR_VERSION:-"latest"}" -export INIT_APPDB_VERSION="${INIT_APPDB_VERSION:-$OPERATOR_VERSION}" -export INIT_DATABASE_VERSION="${INIT_DATABASE_VERSION:-$OPERATOR_VERSION}" -export INIT_OPS_MANAGER_VERSION="${INIT_OPS_MANAGER_VERSION:-$OPERATOR_VERSION}" -export DATABASE_VERSION="${DATABASE_VERSION:-$OPERATOR_VERSION}" +export INIT_APPDB_VERSION="${INIT_APPDB_VERSION:-${OPERATOR_VERSION}}" +export INIT_DATABASE_VERSION="${INIT_DATABASE_VERSION:-${OPERATOR_VERSION}}" +export INIT_OPS_MANAGER_VERSION="${INIT_OPS_MANAGER_VERSION:-${OPERATOR_VERSION}}" +export DATABASE_VERSION="${DATABASE_VERSION:-${OPERATOR_VERSION}}" export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-"latest"}" export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-"latest"}" ### Registries and images export QUAY_REGISTRY="quay.io/mongodb" export REGISTRY=${REGISTRY} -export OPERATOR_REGISTRY=${OPERATOR_REGISTRY:-$REGISTRY} -export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-$REGISTRY} +export OPERATOR_REGISTRY=${OPERATOR_REGISTRY:-${REGISTRY}} +export INIT_IMAGES_REGISTRY=${INIT_IMAGES_REGISTRY:-${REGISTRY}} # Specific registries for different images, can be overridden if needed -export INIT_APPDB_REGISTRY=${INIT_APPDB_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_APPDB_REGISTRY=${INIT_APPDB_REGISTRY:-${INIT_IMAGES_REGISTRY}} export INIT_APPDB_IMAGE_REPOSITORY="${INIT_APPDB_REGISTRY}/mongodb-kubernetes-init-appdb" -export INIT_OPS_MANAGER_REGISTRY=${INIT_OPS_MANAGER_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_OPS_MANAGER_REGISTRY=${INIT_OPS_MANAGER_REGISTRY:-${INIT_IMAGES_REGISTRY}} export INIT_OPS_MANAGER_IMAGE_REPOSITORY="${INIT_OPS_MANAGER_REGISTRY}/mongodb-kubernetes-init-ops-manager" -export INIT_DATABASE_REGISTRY=${INIT_DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} +export INIT_DATABASE_REGISTRY=${INIT_DATABASE_REGISTRY:-${INIT_IMAGES_REGISTRY}} export INIT_DATABASE_IMAGE_REPOSITORY="${INIT_DATABASE_REGISTRY}/mongodb-kubernetes-init-database" -export DATABASE_REGISTRY=${DATABASE_REGISTRY:-$INIT_IMAGES_REGISTRY} +export DATABASE_REGISTRY=${DATABASE_REGISTRY:-${INIT_IMAGES_REGISTRY}} export MONGODB_ENTERPRISE_DATABASE_IMAGE="${DATABASE_REGISTRY}/mongodb-kubernetes-database" -export OPS_MANAGER_REGISTRY=${OPS_MANAGER_REGISTRY:-$REGISTRY} +export OPS_MANAGER_REGISTRY=${OPS_MANAGER_REGISTRY:-${REGISTRY}} export OPS_MANAGER_IMAGE_REPOSITORY="${OPS_MANAGER_REGISTRY}/mongodb-enterprise-ops-manager-ubi" -export MDB_AGENT_REGISTRY=${MDB_AGENT_REGISTRY:-$REGISTRY} +export MDB_AGENT_REGISTRY=${MDB_AGENT_REGISTRY:-${REGISTRY}} export MDB_AGENT_IMAGE_REPOSITORY="${MDB_AGENT_REGISTRY}/mongodb-agent" -export MONGODB_REPO_URL="${MONGODB_REPO_URL:-$QUAY_REGISTRY}" -export MEKO_TESTS_REGISTRY=${MEKO_TESTS_REGISTRY:-$REGISTRY} +export MONGODB_REPO_URL="${MONGODB_REPO_URL:-${QUAY_REGISTRY}}" +export MEKO_TESTS_REGISTRY=${MEKO_TESTS_REGISTRY:-${REGISTRY}} export MEKO_TESTS_IMAGE_REPOSITORY="${MEKO_TESTS_REGISTRY}/mongodb-kubernetes-tests" -export READINESS_PROBE_REGISTRY=${READINESS_PROBE_REGISTRY:-$REGISTRY} -export VERSION_UPGRADE_HOOK_REGISTRY=${VERSION_UPGRADE_HOOK_REGISTRY:-$REGISTRY} +export READINESS_PROBE_REGISTRY=${READINESS_PROBE_REGISTRY:-${REGISTRY}} +export VERSION_UPGRADE_HOOK_REGISTRY=${VERSION_UPGRADE_HOOK_REGISTRY:-${REGISTRY}} export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" export READINESS_PROBE_IMAGE="${READINESS_PROBE_REGISTRY}/mongodb-kubernetes-readinessprobe:${READINESS_PROBE_VERSION}" From ee0db736716b23f07469f3ec443ffe64fd25cfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 14:15:35 +0200 Subject: [PATCH 12/21] Don't push latest and olm-tag if main tag exists --- scripts/release/atomic_pipeline.py | 22 +++++++++++++------- scripts/release/build/image_build_process.py | 15 ------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/scripts/release/atomic_pipeline.py b/scripts/release/atomic_pipeline.py index faf491030..78ed90baa 100755 --- a/scripts/release/atomic_pipeline.py +++ b/scripts/release/atomic_pipeline.py @@ -26,6 +26,7 @@ ) from scripts.release.build.image_build_configuration import ImageBuildConfiguration from scripts.release.build.image_build_process import ( + check_if_image_exists, execute_docker_build, ) from scripts.release.build.image_signing import ( @@ -76,12 +77,20 @@ def build_image( # Build the image once with all repository tags tags = [] for registry in registries: - tags.append(f"{registry}:{build_configuration.version}") - if build_configuration.latest_tag: - tags.append(f"{registry}:latest") - if build_configuration.olm_tag: - olm_tag = create_olm_version_tag(build_configuration.version) - tags.append(f"{registry}:{olm_tag}") + tag = f"{registry}:{build_configuration.version}" + if build_configuration.skip_if_exists and check_if_image_exists(tag): + logger.info(f"Image with tag {tag} already exists. Skipping it.") + else: + tags.append(tag) + if build_configuration.latest_tag: + tags.append(f"{registry}:latest") + if build_configuration.olm_tag: + olm_tag = create_olm_version_tag(build_configuration.version) + tags.append(f"{registry}:{olm_tag}") + + if not tags: + logger.info("All specified image tags already exist. Skipping build.") + return logger.info( f"Building image with tags {tags} for platforms={build_configuration.platforms}, dockerfile args: {build_args}" @@ -93,7 +102,6 @@ def build_image( path=build_path, args=build_args, push=True, - skip_if_exists=build_configuration.skip_if_exists, platforms=build_configuration.platforms, ) diff --git a/scripts/release/build/image_build_process.py b/scripts/release/build/image_build_process.py index 9261df987..6469c258a 100644 --- a/scripts/release/build/image_build_process.py +++ b/scripts/release/build/image_build_process.py @@ -85,7 +85,6 @@ def execute_docker_build( Dict[str, str], push: bool, platforms: list[str], - skip_if_exists: bool, builder_name: str = DEFAULT_BUILDER_NAME, ): """ @@ -105,20 +104,6 @@ def execute_docker_build( docker_cmd = python_on_whales.docker - if skip_if_exists: - filtered_tags = [] - for tag in tags: - if check_if_image_exists(tag): - logger.info(f"Image with tag {tag} already exists. Skipping it.") - else: - filtered_tags.append(tag) - - if not filtered_tags: - logger.info("All specified image tags already exist. Skipping build.") - return - - tags = filtered_tags - try: # Convert build args to the format expected by python_on_whales build_args = {k: str(v) for k, v in args.items()} From bcdb67a259c51a778673e425347a78fb4fdeacbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 17 Sep 2025 15:41:17 +0200 Subject: [PATCH 13/21] Fix `skip-if-exists` issue --- scripts/release/build/image_build_process.py | 25 +++++++++++++------- scripts/release/pipeline.py | 4 +++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/release/build/image_build_process.py b/scripts/release/build/image_build_process.py index 6469c258a..3ad006de2 100644 --- a/scripts/release/build/image_build_process.py +++ b/scripts/release/build/image_build_process.py @@ -43,7 +43,16 @@ def ecr_login_boto3(region: str, account_id: str): def check_if_image_exists(image_tag: str) -> bool: docker_cmd = python_on_whales.docker - return docker_cmd.image.exists(image_tag) + try: + docker_cmd.buildx.imagetools.inspect(image_tag) + except DockerException as e: + decoded_stderr = e.stderr.lower() + if any(str(error) in decoded_stderr for error in ["no such image", "image not known", "not found"]): + return False + else: + raise e + else: + return True def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str: @@ -79,13 +88,13 @@ def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str: def execute_docker_build( - tags: list[str], - dockerfile: str, - path: str, args: - Dict[str, str], - push: bool, - platforms: list[str], - builder_name: str = DEFAULT_BUILDER_NAME, + tags: list[str], + dockerfile: str, + path: str, args: + Dict[str, str], + push: bool, + platforms: list[str], + builder_name: str = DEFAULT_BUILDER_NAME, ): """ Build a Docker image using python_on_whales and Docker Buildx for multi-architecture support. diff --git a/scripts/release/pipeline.py b/scripts/release/pipeline.py index 254122283..55c107953 100644 --- a/scripts/release/pipeline.py +++ b/scripts/release/pipeline.py @@ -118,6 +118,7 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration: platforms = get_platforms_from_arg(args.platform) or image_build_info.platforms sign = args.sign or image_build_info.sign dockerfile_path = image_build_info.dockerfile_path + skip_if_exists = image_build_info.skip_if_exists # Validate version - only agent can have None version as the versions are managed by the agent # which are externally retrieved from release.json @@ -131,9 +132,10 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration: olm_tag=olm_tag, registries=registries, dockerfile_path=dockerfile_path, - parallel=args.parallel, platforms=platforms, sign=sign, + skip_if_exists=skip_if_exists, + parallel=args.parallel, parallel_factor=args.parallel_factor, all_agents=args.all_agents, currently_used_agents=args.current_agents, From 15d63da5c59a54eb379eee83de4e8233a5656a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Thu, 18 Sep 2025 11:26:29 +0200 Subject: [PATCH 14/21] Review feedback --- scripts/dev/contexts/root-context | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index c48213549..9869b277f 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -47,8 +47,10 @@ export OPS_MANAGER_NAMESPACE="operator-testing-50-current" export LOCAL_RUN=true if [[ "${OVERRIDE_VERSION_ID:-}" != "" ]]; then - echo "Overriding operator version with ${OVERRIDE_VERSION_ID}" + echo "Overriding operator related versions with ${OVERRIDE_VERSION_ID}" OPERATOR_VERSION="${OVERRIDE_VERSION_ID}" + READINESS_PROBE_VERSION="${OVERRIDE_VERSION_ID}" + VERSION_UPGRADE_HOOK_VERSION="${OVERRIDE_VERSION_ID}" fi export OPERATOR_VERSION="${OPERATOR_VERSION:-"latest"}" From 1f999053866b954acd8ac81af113bb203d218a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Mon, 22 Sep 2025 10:36:10 +0200 Subject: [PATCH 15/21] Fixes for review comments --- scripts/dev/contexts/root-context | 4 ++-- scripts/release/retag_images_to_staging.sh | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/dev/contexts/root-context b/scripts/dev/contexts/root-context index 05b116ae2..714aa15cf 100644 --- a/scripts/dev/contexts/root-context +++ b/scripts/dev/contexts/root-context @@ -60,8 +60,8 @@ export INIT_APPDB_VERSION="${INIT_APPDB_VERSION:-${OPERATOR_VERSION}}" export INIT_DATABASE_VERSION="${INIT_DATABASE_VERSION:-${OPERATOR_VERSION}}" export INIT_OPS_MANAGER_VERSION="${INIT_OPS_MANAGER_VERSION:-${OPERATOR_VERSION}}" export DATABASE_VERSION="${DATABASE_VERSION:-${OPERATOR_VERSION}}" -export READINESS_PROBE_VERSION="${READINESS_PROBE_VERSION:-${READINESS_PROBE_VERSION}}" -export VERSION_UPGRADE_HOOK_VERSION="${VERSION_UPGRADE_HOOK_VERSION:-${VERSION_UPGRADE_HOOK_VERSION}}" +export READINESS_PROBE_VERSION +export VERSION_UPGRADE_HOOK_VERSION ### Registries and images export QUAY_REGISTRY="quay.io/mongodb" diff --git a/scripts/release/retag_images_to_staging.sh b/scripts/release/retag_images_to_staging.sh index 340a45ca7..e9f4549c3 100755 --- a/scripts/release/retag_images_to_staging.sh +++ b/scripts/release/retag_images_to_staging.sh @@ -2,9 +2,11 @@ set -Eeou pipefail +# SINGLE SHOT SCRIPT, NOT USED IN CI/CD PIPELINES # Utility used to retag and push container images from one repo to another # Useful for migrating images between different repositories (e.g. dev -> staging) + image_exists() { local image_tag="$1" if docker manifest inspect "${image_tag}" > /dev/null 2>&1; then From 1d66ef8b400fb750e3c04fbb427b7b1c26bf5747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Mon, 22 Sep 2025 12:01:20 +0200 Subject: [PATCH 16/21] Add comment on dummy version --- scripts/release/release_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/release_info.py b/scripts/release/release_info.py index 5ae0bcf8c..c5f1b2e24 100644 --- a/scripts/release/release_info.py +++ b/scripts/release/release_info.py @@ -30,7 +30,7 @@ UPGRADE_HOOK_IMAGE, ] -# TODO: this is dummy version, to be replaced with actual versioning logic +# TODO: this is dummy version, to be replaced with actual versioning logic https://docs.google.com/document/d/1eJ8iKsI0libbpcJakGjxcPfbrTn8lmcZDbQH1UqMR_g/edit?tab=t.45ig7xr3e3w4#bookmark=id.748ik8snxcyl DUMMY_VERSION = "dummy_version" From a5bbb9fc492e0b9c6ceb7b60a6cf19d64830047c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Tue, 30 Sep 2025 14:39:05 +0200 Subject: [PATCH 17/21] Move `meko-tests.release` to `quay.io/mongodb/mongodb-kubernetes-tests` --- build_info.json | 2 +- scripts/dev/contexts/e2e_smoke | 1 - scripts/dev/contexts/e2e_smoke_arm | 1 - scripts/dev/contexts/e2e_smoke_ibm_power | 1 - scripts/dev/contexts/e2e_smoke_ibm_z | 1 - scripts/dev/contexts/e2e_static_smoke | 1 - scripts/dev/contexts/e2e_static_smoke_arm | 1 - scripts/dev/contexts/e2e_static_smoke_ibm_power | 1 - scripts/dev/contexts/e2e_static_smoke_ibm_z | 1 - scripts/release/tests/build_info_test.py | 2 +- 10 files changed, 2 insertions(+), 10 deletions(-) diff --git a/build_info.json b/build_info.json index b85686891..e57265f84 100644 --- a/build_info.json +++ b/build_info.json @@ -180,7 +180,7 @@ ] }, "release": { - "repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], + "repositories": ["quay.io/mongodb/mongodb-kubernetes-tests"], "platforms": [ "linux/amd64" ] diff --git a/scripts/dev/contexts/e2e_smoke b/scripts/dev/contexts/e2e_smoke index fa5265f5f..8c5438743 100644 --- a/scripts/dev/contexts/e2e_smoke +++ b/scripts/dev/contexts/e2e_smoke @@ -6,5 +6,4 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/om70" diff --git a/scripts/dev/contexts/e2e_smoke_arm b/scripts/dev/contexts/e2e_smoke_arm index a91df4ad8..caab9ef79 100644 --- a/scripts/dev/contexts/e2e_smoke_arm +++ b/scripts/dev/contexts/e2e_smoke_arm @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" export ops_manager_version="cloud_qa" diff --git a/scripts/dev/contexts/e2e_smoke_ibm_power b/scripts/dev/contexts/e2e_smoke_ibm_power index 4c1728a43..6498bdbf7 100644 --- a/scripts/dev/contexts/e2e_smoke_ibm_power +++ b/scripts/dev/contexts/e2e_smoke_ibm_power @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') diff --git a/scripts/dev/contexts/e2e_smoke_ibm_z b/scripts/dev/contexts/e2e_smoke_ibm_z index 4c1728a43..6498bdbf7 100644 --- a/scripts/dev/contexts/e2e_smoke_ibm_z +++ b/scripts/dev/contexts/e2e_smoke_ibm_z @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') diff --git a/scripts/dev/contexts/e2e_static_smoke b/scripts/dev/contexts/e2e_static_smoke index ca5e4a0f4..2d73c4376 100644 --- a/scripts/dev/contexts/e2e_static_smoke +++ b/scripts/dev/contexts/e2e_static_smoke @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/om70" export MDB_DEFAULT_ARCHITECTURE=static diff --git a/scripts/dev/contexts/e2e_static_smoke_arm b/scripts/dev/contexts/e2e_static_smoke_arm index da029d303..8a4695600 100644 --- a/scripts/dev/contexts/e2e_static_smoke_arm +++ b/scripts/dev/contexts/e2e_static_smoke_arm @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" export ops_manager_version="cloud_qa" diff --git a/scripts/dev/contexts/e2e_static_smoke_ibm_power b/scripts/dev/contexts/e2e_static_smoke_ibm_power index a13040feb..acc21caa3 100644 --- a/scripts/dev/contexts/e2e_static_smoke_ibm_power +++ b/scripts/dev/contexts/e2e_static_smoke_ibm_power @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') diff --git a/scripts/dev/contexts/e2e_static_smoke_ibm_z b/scripts/dev/contexts/e2e_static_smoke_ibm_z index 394984430..97a1d51ce 100644 --- a/scripts/dev/contexts/e2e_static_smoke_ibm_z +++ b/scripts/dev/contexts/e2e_static_smoke_ibm_z @@ -6,7 +6,6 @@ script_name=$(readlink -f "${BASH_SOURCE[0]}") script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" -source "${script_dir}/variables/e2e_smoke_base" source "${script_dir}/variables/e2e_ibm_smoke_base" CUSTOM_OM_VERSION=$(grep -E "^\s*-\s*&ops_manager_70_latest\s+(\S+)\s+#" <"${script_dir}"/../../../.evergreen.yml | awk '{print $3}') diff --git a/scripts/release/tests/build_info_test.py b/scripts/release/tests/build_info_test.py index 52cbc248e..d5f169f5e 100644 --- a/scripts/release/tests/build_info_test.py +++ b/scripts/release/tests/build_info_test.py @@ -322,7 +322,7 @@ def test_load_build_info_release(): sign=True, ), "meko-tests": ImageInfo( - repositories=["268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"], + repositories=["quay.io/mongodb/mongodb-kubernetes-tests"], platforms=["linux/amd64"], dockerfile_path="docker/mongodb-kubernetes-tests/Dockerfile", ), From 5d6a716b7b99de27462f2fd1d58f4e536a03c52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Tue, 30 Sep 2025 21:35:45 +0200 Subject: [PATCH 18/21] Don't build agents on each PR --- .evergreen.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.evergreen.yml b/.evergreen.yml index ef36e4fa6..9396d211b 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -401,8 +401,6 @@ tasks: - func: clone - func: setup_building_host - func: pipeline_agent - vars: - FLAGS: "--current-agents" - name: build_init_database_image_ubi commands: From 9b40c452f0f8c44eb8fce19573a646e4fdfe8890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 8 Oct 2025 15:59:44 +0200 Subject: [PATCH 19/21] Fix switch-context issues + context cleanup --- .evergreen-functions.yml | 18 ---------- .evergreen-snippets.yml | 2 ++ .evergreen-tasks.yml | 11 ------ .evergreen.yml | 36 +++++++------------ .../dev/contexts/init_release_agents_on_ecr | 10 ------ scripts/dev/contexts/init_test_run | 8 ----- scripts/dev/contexts/init_test_run_ibm | 8 ----- scripts/dev/contexts/init_tests_with_olm | 9 ----- scripts/dev/contexts/migrate_all_agents | 10 ------ scripts/dev/contexts/preflight_om60_images | 11 ------ scripts/dev/contexts/preflight_om70_images | 11 ------ scripts/dev/contexts/preflight_om80_images | 11 ------ scripts/dev/contexts/preflight_release_images | 10 ------ .../contexts/preflight_release_images_check | 10 ------ scripts/dev/contexts/publish_om60_images | 2 -- scripts/dev/contexts/publish_om70_images | 2 -- scripts/dev/contexts/publish_om80_images | 2 -- scripts/dev/contexts/release_agent | 11 ------ scripts/dev/contexts/release_images | 8 ----- 19 files changed, 14 insertions(+), 176 deletions(-) delete mode 100644 scripts/dev/contexts/init_release_agents_on_ecr delete mode 100644 scripts/dev/contexts/init_test_run delete mode 100644 scripts/dev/contexts/init_test_run_ibm delete mode 100644 scripts/dev/contexts/init_tests_with_olm delete mode 100644 scripts/dev/contexts/migrate_all_agents delete mode 100644 scripts/dev/contexts/preflight_om60_images delete mode 100644 scripts/dev/contexts/preflight_om70_images delete mode 100644 scripts/dev/contexts/preflight_om80_images delete mode 100644 scripts/dev/contexts/preflight_release_images delete mode 100644 scripts/dev/contexts/preflight_release_images_check delete mode 100644 scripts/dev/contexts/release_agent delete mode 100644 scripts/dev/contexts/release_images diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index 79b60f39d..118a43c69 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -268,7 +268,6 @@ functions: # Configures docker authentication to ECR and RH registries. setup_building_host: - - *switch_context - *python_venv - *setup_aws - *setup_evg_host @@ -277,7 +276,6 @@ functions: # 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: - - *switch_context - command: subprocess.exec type: setup params: @@ -351,7 +349,6 @@ functions: command: "docker login quay.io -u ${quay_prod_username} -p ${quay_prod_robot_token}" setup_cloud_qa: - - *switch_context - command: shell.exec type: setup params: @@ -482,7 +479,6 @@ functions: files: [ "src/github.com/mongodb/mongodb-kubernetes/logs/*.suite" ] preflight_image: - - *switch_context - command: subprocess.exec params: working_dir: src/github.com/mongodb/mongodb-kubernetes @@ -510,7 +506,6 @@ functions: - ${workdir} build_test_image_ibm: - - *switch_context - command: subprocess.exec params: shell: bash @@ -520,10 +515,8 @@ functions: binary: scripts/evergreen/e2e/build_tests_image_ibm.sh pipeline: - - *switch_context - command: subprocess.exec retry_on_failure: true - type: setup params: shell: bash <<: *e2e_include_expansions_in_env @@ -533,10 +526,8 @@ functions: IMAGE_NAME: ${IMAGE_NAME} pipeline_agent: - - *switch_context - command: subprocess.exec retry_on_failure: true - type: setup params: shell: bash <<: *e2e_include_expansions_in_env @@ -546,10 +537,8 @@ functions: FLAGS: ${FLAGS} pipeline_ops_manager: - - *switch_context - command: subprocess.exec retry_on_failure: true - type: setup params: shell: bash <<: *e2e_include_expansions_in_env @@ -557,10 +546,8 @@ functions: binary: scripts/release/pipeline_ops_manager.sh pipeline_readiness_probe: - - *switch_context - command: subprocess.exec retry_on_failure: true - type: setup params: shell: bash <<: *e2e_include_expansions_in_env @@ -568,10 +555,8 @@ functions: binary: scripts/release/pipeline_readiness_probe.sh pipeline_version_upgrade_hook: - - *switch_context - command: subprocess.exec retry_on_failure: true - type: setup params: shell: bash <<: *e2e_include_expansions_in_env @@ -579,7 +564,6 @@ functions: binary: scripts/release/pipeline_version_upgrade_hook.sh teardown_cloud_qa_all: - - *switch_context - command: shell.exec type: setup params: @@ -735,7 +719,6 @@ functions: make sbom-tests generate_perf_tests_tasks: - - *switch_context - command: shell.exec type: setup params: @@ -820,7 +803,6 @@ functions: # it executes a script by convention: ./scripts/code_snippets/tests/${task_name} test_code_snippets: - - *switch_context - command: shell.exec params: shell: bash diff --git a/.evergreen-snippets.yml b/.evergreen-snippets.yml index 8859e59f7..5a61f6592 100644 --- a/.evergreen-snippets.yml +++ b/.evergreen-snippets.yml @@ -6,6 +6,7 @@ variables: - func: setup_gcloud_cli - func: setup_mongosh - func: download_kube_tools + - func: switch_context - func: build_multi_cluster_binary teardown_task: - func: upload_e2e_logs @@ -20,6 +21,7 @@ variables: - func: cleanup_exec_environment - func: download_kube_tools - func: configure_docker_auth + - func: switch_context - func: setup_kubernetes_environment - func: python_venv - func: setup_cloud_qa diff --git a/.evergreen-tasks.yml b/.evergreen-tasks.yml index 0cc5ae86c..5059e8a8a 100644 --- a/.evergreen-tasks.yml +++ b/.evergreen-tasks.yml @@ -60,16 +60,6 @@ tasks: vars: image_name: mongodb-agent - - name: preflight_om_image - tags: [ "image_preflight" ] - commands: - - func: clone - - func: python_venv - - func: setup_preflight - - func: preflight_image - vars: - image_name: ops-manager - # Code snippets tasks # Each task is selected by convention by running scripts/code_snippets/${task_name}_test.sh - name: task_gke_multi_cluster_snippets @@ -1318,4 +1308,3 @@ tasks: tags: [ "patch-run" ] commands: - func: "e2e_test" - diff --git a/.evergreen.yml b/.evergreen.yml index 1f1bb0adf..de1aa98cb 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -73,12 +73,14 @@ variables: setup_group: - func: clone - func: download_kube_tools + - func: switch_context - func: setup_building_host - &setup_group_ibm setup_group_can_fail_task: true setup_group: - func: clone + - func: switch_context - func: setup_building_host_minikube - func: build_multi_cluster_binary @@ -87,6 +89,7 @@ variables: setup_group: - func: clone - func: download_kube_tools + - func: switch_context - func: setup_building_host - func: build_multi_cluster_binary @@ -95,6 +98,7 @@ variables: setup_task: - func: cleanup_exec_environment - func: configure_docker_auth + - func: switch_context - func: setup_kubernetes_environment - func: setup_cloud_qa teardown_task_can_fail_task: true @@ -109,6 +113,7 @@ variables: - func: cleanup_exec_environment - func: configure_docker_auth - func: setup_kubernetes_environment + - func: switch_context teardown_task_can_fail_task: true teardown_task: - func: upload_e2e_logs @@ -446,6 +451,7 @@ tasks: - name: generate_perf_tasks_one_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf_one_thread @@ -454,6 +460,7 @@ tasks: - name: generate_perf_tasks_10_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf @@ -462,6 +469,7 @@ tasks: - name: generate_perf_tasks_30_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf_thirty @@ -470,12 +478,14 @@ tasks: - name: build_om_images commands: - func: clone + - func: switch_context - func: setup_building_host - func: pipeline_ops_manager - name: publish_ops_manager commands: - func: clone + - func: switch_context - func: setup_building_host - func: quay_login - func: setup_docker_sbom @@ -1735,6 +1745,8 @@ buildvariants: tags: [ "staging" ] run_on: - rhel90-large + expansions: + preflight_submit: false tasks: - name: preflight_images_task_group @@ -1746,14 +1758,6 @@ buildvariants: tasks: - name: build_om_images - - name: preflight_om60_images - display_name: preflight_om60_images - tags: [ "staging" ] - run_on: - - rhel90-large - tasks: - - name: preflight_om_image - - name: build_om70_images display_name: build_om70_images tags: [ "pr_patch", "staging" ] @@ -1762,14 +1766,6 @@ buildvariants: tasks: - name: build_om_images - - name: preflight_om70_images - display_name: preflight_om70_images - tags: [ "staging" ] - run_on: - - rhel90-large - tasks: - - name: preflight_om_image - - name: build_om80_images display_name: build_om80_images tags: [ "pr_patch", "staging" ] @@ -1778,14 +1774,6 @@ buildvariants: tasks: - name: build_om_images - - name: preflight_om80_images - display_name: preflight_om80_images - tags: [ "staging" ] - run_on: - - rhel90-large - tasks: - - name: preflight_om_image - # It will be called by pct while bumping the agent cloud manager image - name: release_agent display_name: release_agent diff --git a/scripts/dev/contexts/init_release_agents_on_ecr b/scripts/dev/contexts/init_release_agents_on_ecr deleted file mode 100644 index 606597585..000000000 --- a/scripts/dev/contexts/init_release_agents_on_ecr +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - -export all_agents="true" diff --git a/scripts/dev/contexts/init_test_run b/scripts/dev/contexts/init_test_run deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/init_test_run +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/init_test_run_ibm b/scripts/dev/contexts/init_test_run_ibm deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/init_test_run_ibm +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/init_tests_with_olm b/scripts/dev/contexts/init_tests_with_olm deleted file mode 100644 index c66fed75e..000000000 --- a/scripts/dev/contexts/init_tests_with_olm +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - diff --git a/scripts/dev/contexts/migrate_all_agents b/scripts/dev/contexts/migrate_all_agents deleted file mode 100644 index bd0b34500..000000000 --- a/scripts/dev/contexts/migrate_all_agents +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - -export preflight_submit=true diff --git a/scripts/dev/contexts/preflight_om60_images b/scripts/dev/contexts/preflight_om60_images deleted file mode 100644 index 56226987c..000000000 --- a/scripts/dev/contexts/preflight_om60_images +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" -source "${script_dir}/variables/om60_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/preflight_om70_images b/scripts/dev/contexts/preflight_om70_images deleted file mode 100644 index 741902b05..000000000 --- a/scripts/dev/contexts/preflight_om70_images +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" -source "${script_dir}/variables/om70_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/preflight_om80_images b/scripts/dev/contexts/preflight_om80_images deleted file mode 100644 index 041661c7f..000000000 --- a/scripts/dev/contexts/preflight_om80_images +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" -source "${script_dir}/variables/om80_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/preflight_release_images b/scripts/dev/contexts/preflight_release_images deleted file mode 100644 index bd0b34500..000000000 --- a/scripts/dev/contexts/preflight_release_images +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - -export preflight_submit=true diff --git a/scripts/dev/contexts/preflight_release_images_check b/scripts/dev/contexts/preflight_release_images_check deleted file mode 100644 index 94a7a9ead..000000000 --- a/scripts/dev/contexts/preflight_release_images_check +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - -export preflight_submit=false diff --git a/scripts/dev/contexts/publish_om60_images b/scripts/dev/contexts/publish_om60_images index 56226987c..b82d46d55 100644 --- a/scripts/dev/contexts/publish_om60_images +++ b/scripts/dev/contexts/publish_om60_images @@ -7,5 +7,3 @@ script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" source "${script_dir}/variables/om60_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/publish_om70_images b/scripts/dev/contexts/publish_om70_images index 741902b05..dfd4c775f 100644 --- a/scripts/dev/contexts/publish_om70_images +++ b/scripts/dev/contexts/publish_om70_images @@ -7,5 +7,3 @@ script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" source "${script_dir}/variables/om70_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/publish_om80_images b/scripts/dev/contexts/publish_om80_images index 041661c7f..a5896ad77 100644 --- a/scripts/dev/contexts/publish_om80_images +++ b/scripts/dev/contexts/publish_om80_images @@ -7,5 +7,3 @@ script_dir=$(dirname "${script_name}") source "${script_dir}/root-context" source "${script_dir}/variables/om80_image" - -export preflight_submit=true diff --git a/scripts/dev/contexts/release_agent b/scripts/dev/contexts/release_agent deleted file mode 100644 index 04bc1a4e3..000000000 --- a/scripts/dev/contexts/release_agent +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -# This will be removed once the main branch of the Static Containers will be merged. -source "${script_dir}/root-context" - -export preflight_submit=false diff --git a/scripts/dev/contexts/release_images b/scripts/dev/contexts/release_images deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/release_images +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" From 9a7f17d02a576f2b908efb0562f5f137c2dcd992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 8 Oct 2025 16:09:45 +0200 Subject: [PATCH 20/21] Remove obsolete `108.0.0.8694-1` agent version + bumping `107.0.17.8771-1` used in tests --- config/manager/manager.yaml | 2 -- helm_chart/values-openshift.yaml | 1 - public/mongodb-kubernetes-openshift.yaml | 2 -- release.json | 4 ---- scripts/dev/contexts/variables/om70 | 2 +- scripts/dev/contexts/variables/om80 | 2 +- 6 files changed, 2 insertions(+), 11 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 9e8a27f29..e8e9e35e7 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -140,8 +140,6 @@ spec: value: "quay.io/mongodb/mongodb-agent:107.0.17.8771-1" - name: RELATED_IMAGE_AGENT_IMAGE_107_0_18_8784_1 value: "quay.io/mongodb/mongodb-agent:107.0.18.8784-1" - - name: RELATED_IMAGE_AGENT_IMAGE_108_0_0_8694_1 - value: "quay.io/mongodb/mongodb-agent:108.0.0.8694-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_1_8718_1 value: "quay.io/mongodb/mongodb-agent:108.0.1.8718-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_11_8830_1 diff --git a/helm_chart/values-openshift.yaml b/helm_chart/values-openshift.yaml index 59a23bca2..7975280a3 100644 --- a/helm_chart/values-openshift.yaml +++ b/helm_chart/values-openshift.yaml @@ -107,7 +107,6 @@ relatedImages: - 107.0.15.8741-1 - 107.0.17.8771-1 - 107.0.18.8784-1 - - 108.0.0.8694-1 - 108.0.1.8718-1 - 108.0.11.8830-1 - 108.0.12.8846-1 diff --git a/public/mongodb-kubernetes-openshift.yaml b/public/mongodb-kubernetes-openshift.yaml index ff99a0b2f..8cd4c8d76 100644 --- a/public/mongodb-kubernetes-openshift.yaml +++ b/public/mongodb-kubernetes-openshift.yaml @@ -444,8 +444,6 @@ spec: value: "quay.io/mongodb/mongodb-agent:107.0.17.8771-1" - name: RELATED_IMAGE_AGENT_IMAGE_107_0_18_8784_1 value: "quay.io/mongodb/mongodb-agent:107.0.18.8784-1" - - name: RELATED_IMAGE_AGENT_IMAGE_108_0_0_8694_1 - value: "quay.io/mongodb/mongodb-agent:108.0.0.8694-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_1_8718_1 value: "quay.io/mongodb/mongodb-agent:108.0.1.8718-1" - name: RELATED_IMAGE_AGENT_IMAGE_108_0_11_8830_1 diff --git a/release.json b/release.json index c088b8e0c..a7ad646a4 100644 --- a/release.json +++ b/release.json @@ -140,10 +140,6 @@ "agent_version": "107.0.18.8784-1", "tools_version": "100.13.0" }, - "8.0.0": { - "agent_version": "108.0.0.8694-1", - "tools_version": "100.10.0" - }, "8.0.1": { "agent_version": "108.0.1.8718-1", "tools_version": "100.10.0" diff --git a/scripts/dev/contexts/variables/om70 b/scripts/dev/contexts/variables/om70 index 4648fbc4e..f2b94f280 100644 --- a/scripts/dev/contexts/variables/om70 +++ b/scripts/dev/contexts/variables/om70 @@ -10,7 +10,7 @@ export CUSTOM_OM_VERSION export CUSTOM_MDB_VERSION=7.0.18 export CUSTOM_MDB_PREV_VERSION=6.0.21 -export AGENT_VERSION=107.0.17.8771-1 +export AGENT_VERSION=107.0.18.8784-1 export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" export CUSTOM_APPDB_VERSION=7.0.18-ent diff --git a/scripts/dev/contexts/variables/om80 b/scripts/dev/contexts/variables/om80 index 721db6aea..7053a52c2 100644 --- a/scripts/dev/contexts/variables/om80 +++ b/scripts/dev/contexts/variables/om80 @@ -10,7 +10,7 @@ export CUSTOM_OM_VERSION export CUSTOM_MDB_VERSION=8.0.6 export CUSTOM_MDB_PREV_VERSION=7.0.18 -export AGENT_VERSION=108.0.0.8694-1 +export AGENT_VERSION=108.0.1.8718-1 export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}" export CUSTOM_APPDB_VERSION=8.0.6-ent From 655cc5434fba662a48b61bac92caa679babfe698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kara=C5=9B?= Date: Wed, 8 Oct 2025 15:59:44 +0200 Subject: [PATCH 21/21] Fix switch-context issues + context cleanup --- .evergreen-functions.yml | 11 ----------- .evergreen-snippets.yml | 2 ++ .evergreen-tasks.yml | 10 ---------- .evergreen.yml | 10 ++++++++++ scripts/dev/contexts/init_release_agents_on_ecr | 10 ---------- scripts/dev/contexts/init_test_run | 8 -------- scripts/dev/contexts/init_test_run_ibm | 8 -------- scripts/dev/contexts/init_tests_with_olm | 9 --------- scripts/dev/contexts/migrate_all_agents | 8 -------- scripts/dev/contexts/preflight_release_images | 8 -------- .../dev/contexts/preflight_release_images_check_only | 8 -------- scripts/dev/contexts/release_agent | 9 --------- scripts/dev/contexts/release_images | 8 -------- 13 files changed, 12 insertions(+), 97 deletions(-) delete mode 100644 scripts/dev/contexts/init_release_agents_on_ecr delete mode 100644 scripts/dev/contexts/init_test_run delete mode 100644 scripts/dev/contexts/init_test_run_ibm delete mode 100644 scripts/dev/contexts/init_tests_with_olm delete mode 100644 scripts/dev/contexts/migrate_all_agents delete mode 100644 scripts/dev/contexts/preflight_release_images delete mode 100644 scripts/dev/contexts/preflight_release_images_check_only delete mode 100644 scripts/dev/contexts/release_agent delete mode 100644 scripts/dev/contexts/release_images diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index 760131617..2b77984e2 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -267,7 +267,6 @@ functions: # Configures docker authentication to ECR and RH registries. setup_building_host: - - *switch_context - *python_venv - *setup_aws - *setup_evg_host @@ -276,7 +275,6 @@ functions: # 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: - - *switch_context - command: subprocess.exec type: setup params: @@ -350,7 +348,6 @@ functions: command: "docker login quay.io -u ${quay_prod_username} -p ${quay_prod_robot_token}" setup_cloud_qa: - - *switch_context - command: shell.exec type: setup params: @@ -481,7 +478,6 @@ functions: files: [ "src/github.com/mongodb/mongodb-kubernetes/logs/*.suite" ] preflight_image: - - *switch_context - command: subprocess.exec params: working_dir: src/github.com/mongodb/mongodb-kubernetes @@ -509,7 +505,6 @@ functions: - ${workdir} build_test_image_ibm: - - *switch_context - command: subprocess.exec params: shell: bash @@ -521,7 +516,6 @@ functions: binary: scripts/evergreen/e2e/build_tests_image_ibm.sh pipeline_migrate_agents: - - *switch_context - command: subprocess.exec retry_on_failure: false type: setup @@ -532,7 +526,6 @@ functions: binary: scripts/release/pipeline_migrate_agent.sh pipeline: - - *switch_context - command: subprocess.exec retry_on_failure: true type: setup @@ -544,7 +537,6 @@ functions: # TODO: this function is very similar to pipeline and it will joined with it in the future release_operator_pipeline: - - *switch_context - command: subprocess.exec retry_on_failure: true type: setup @@ -556,7 +548,6 @@ functions: binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py ${image_name} --build-scenario release --version ${RELEASE_OPERATOR_VERSION|*triggered_by_git_tag} teardown_cloud_qa_all: - - *switch_context - command: shell.exec type: setup params: @@ -712,7 +703,6 @@ functions: make sbom-tests generate_perf_tests_tasks: - - *switch_context - command: shell.exec type: setup params: @@ -797,7 +787,6 @@ functions: # it executes a script by convention: ./scripts/code_snippets/tests/${task_name} test_code_snippets: - - *switch_context - command: shell.exec params: shell: bash diff --git a/.evergreen-snippets.yml b/.evergreen-snippets.yml index 8859e59f7..5a61f6592 100644 --- a/.evergreen-snippets.yml +++ b/.evergreen-snippets.yml @@ -6,6 +6,7 @@ variables: - func: setup_gcloud_cli - func: setup_mongosh - func: download_kube_tools + - func: switch_context - func: build_multi_cluster_binary teardown_task: - func: upload_e2e_logs @@ -20,6 +21,7 @@ variables: - func: cleanup_exec_environment - func: download_kube_tools - func: configure_docker_auth + - func: switch_context - func: setup_kubernetes_environment - func: python_venv - func: setup_cloud_qa diff --git a/.evergreen-tasks.yml b/.evergreen-tasks.yml index 2386a78f3..5059e8a8a 100644 --- a/.evergreen-tasks.yml +++ b/.evergreen-tasks.yml @@ -60,16 +60,6 @@ tasks: vars: image_name: mongodb-agent - - name: preflight_om_image - tags: [ "image_preflight" ] - commands: - - func: clone - - func: python_venv - - func: setup_preflight - - func: preflight_image - vars: - image_name: ops-manager - # Code snippets tasks # Each task is selected by convention by running scripts/code_snippets/${task_name}_test.sh - name: task_gke_multi_cluster_snippets diff --git a/.evergreen.yml b/.evergreen.yml index 56bff2823..419c9d605 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -71,12 +71,14 @@ variables: setup_group: - func: clone - func: download_kube_tools + - func: switch_context - func: setup_building_host - &setup_group_ibm setup_group_can_fail_task: true setup_group: - func: clone + - func: switch_context - func: setup_building_host_minikube - func: build_multi_cluster_binary @@ -85,6 +87,7 @@ variables: setup_group: - func: clone - func: download_kube_tools + - func: switch_context - func: setup_building_host - func: build_multi_cluster_binary @@ -93,6 +96,7 @@ variables: setup_task: - func: cleanup_exec_environment - func: configure_docker_auth + - func: switch_context - func: setup_kubernetes_environment - func: setup_cloud_qa teardown_task_can_fail_task: true @@ -107,6 +111,7 @@ variables: - func: cleanup_exec_environment - func: configure_docker_auth - func: setup_kubernetes_environment + - func: switch_context teardown_task_can_fail_task: true teardown_task: - func: upload_e2e_logs @@ -464,6 +469,7 @@ tasks: - name: generate_perf_tasks_one_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf_one_thread @@ -472,6 +478,7 @@ tasks: - name: generate_perf_tasks_10_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf @@ -480,6 +487,7 @@ tasks: - name: generate_perf_tasks_30_thread commands: - func: clone + - func: switch_context - func: generate_perf_tests_tasks vars: variant: e2e_operator_perf_thirty @@ -488,6 +496,7 @@ tasks: - name: build_om_images commands: - func: clone + - func: switch_context - func: setup_building_host - func: pipeline vars: @@ -496,6 +505,7 @@ tasks: - name: publish_ops_manager commands: - func: clone + - func: switch_context - func: setup_building_host - func: quay_login - func: setup_docker_sbom diff --git a/scripts/dev/contexts/init_release_agents_on_ecr b/scripts/dev/contexts/init_release_agents_on_ecr deleted file mode 100644 index 606597585..000000000 --- a/scripts/dev/contexts/init_release_agents_on_ecr +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - -export all_agents="true" diff --git a/scripts/dev/contexts/init_test_run b/scripts/dev/contexts/init_test_run deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/init_test_run +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/init_test_run_ibm b/scripts/dev/contexts/init_test_run_ibm deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/init_test_run_ibm +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/init_tests_with_olm b/scripts/dev/contexts/init_tests_with_olm deleted file mode 100644 index c66fed75e..000000000 --- a/scripts/dev/contexts/init_tests_with_olm +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" - diff --git a/scripts/dev/contexts/migrate_all_agents b/scripts/dev/contexts/migrate_all_agents deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/migrate_all_agents +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/preflight_release_images b/scripts/dev/contexts/preflight_release_images deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/preflight_release_images +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/preflight_release_images_check_only b/scripts/dev/contexts/preflight_release_images_check_only deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/preflight_release_images_check_only +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/release_agent b/scripts/dev/contexts/release_agent deleted file mode 100644 index 67c161bb5..000000000 --- a/scripts/dev/contexts/release_agent +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -# This will be removed once the main branch of the Static Containers will be merged. -source "${script_dir}/root-context" diff --git a/scripts/dev/contexts/release_images b/scripts/dev/contexts/release_images deleted file mode 100644 index 7f7f635e9..000000000 --- a/scripts/dev/contexts/release_images +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -script_name=$(readlink -f "${BASH_SOURCE[0]}") -script_dir=$(dirname "${script_name}") - -source "${script_dir}/root-context"