Skip to content

Commit 3279a03

Browse files
authored
CLOUDP-337357 - Migrate all agents script (#361)
# Summary This pull request introduces a new manual pipeline for migrating and publishing all agent images to a new registry. The main changes add support for running this migration as a manual task in Evergreen, including the necessary pipeline configuration, scripts, and build variant. **Evergreen pipeline and build variant additions:** * Added a new `pipeline_migrate_agents` function to `.evergreen-functions.yml`, which runs the `pipeline_migrate_agent.sh` script for agent migration. * Added a new `migrate_all_agents` task to `.evergreen.yml`, enabling manual execution to build and migrate all agent images. * Created a new `publish_agent_images_manual` build variant in `.evergreen.yml`, allowing patch requesters to trigger the migration task. **Script additions for manual migration:** * Added `scripts/release/pipeline_migrate_agent.sh` to execute the migration logic using the main pipeline Python script, targeting the new registry. To trigger this task, the following command will be run ``` evergreen patch -p mongodb-kubernetes -v migrate_all_agents -t migrate_all_agents -y -f -u --browse -d "" --param evergreen_retry=false ``` ## Proof of Work This [patch](https://spruce.mongodb.com/task/mongodb_kubernetes_publish_agent_images_manual_migrate_all_agents_patch_1e901704a46e0544f3a72cf162f602f88b0f3f63_68ac8827d932140007acd3a8_25_08_25_15_58_33/logs?execution=0) migrates all the agents to my private [ECR](https://us-east-1.console.aws.amazon.com/ecr/repositories/private/268558157000/lucian.tosa/mongodb-agent?region=us-east-1) There are 17 agents in release.json. For each of them there will 4 be images (4 architectures), 1 aggregated manifest, and one signature, therefore 102 entries. This [patch](https://spruce.mongodb.com/version/68adc1ff3ffb18000795f2ee/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC) ran the static tests using my private ECR registry. ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent d40621c commit 3279a03

File tree

10 files changed

+48
-11
lines changed

10 files changed

+48
-11
lines changed

.evergreen-functions.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,17 @@ functions:
541541
- ${workdir}/bin
542542
binary: scripts/evergreen/e2e/build_tests_image_ibm.sh
543543

544+
pipeline_migrate_agents:
545+
- *switch_context
546+
- command: subprocess.exec
547+
retry_on_failure: false
548+
type: setup
549+
params:
550+
shell: bash
551+
<<: *e2e_include_expansions_in_env
552+
working_dir: src/github.com/mongodb/mongodb-kubernetes
553+
binary: scripts/release/pipeline_migrate_agent.sh
554+
544555
pipeline:
545556
- *switch_context
546557
- command: subprocess.exec

.evergreen.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ tasks:
356356
image_name: agent
357357
build_scenario: --build-scenario manual_release
358358

359+
- name: migrate_all_agents
360+
# this enables us to run this variant manually to build all the agents for the new registry
361+
allowed_requesters: [ "patch" ]
362+
commands:
363+
- func: clone
364+
- func: setup_building_host
365+
- func: quay_login
366+
- func: pipeline_migrate_agents
367+
359368
- name: run_precommit_and_push
360369
tags: ["patch-run"]
361370
commands:
@@ -2097,3 +2106,11 @@ buildvariants:
20972106
tasks:
20982107
- name: publish_ops_manager
20992108
- name: release_agent
2109+
2110+
- name: migrate_all_agents
2111+
display_name: migrate_all_agents
2112+
allowed_requesters: [ "patch" ]
2113+
run_on:
2114+
- ubuntu2204-large
2115+
tasks:
2116+
- name: migrate_all_agents

config/manager/manager.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ spec:
130130
value: "quay.io/mongodb/mongodb-kubernetes-init-ops-manager:1.2.0"
131131
- name: RELATED_IMAGE_INIT_APPDB_IMAGE_REPOSITORY_1_2_0
132132
value: "quay.io/mongodb/mongodb-kubernetes-init-appdb:1.2.0"
133-
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_11_8645_1
134-
value: "quay.io/mongodb/mongodb-agent-ubi:107.0.11.8645-1"
135133
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_12_8669_1
136134
value: "quay.io/mongodb/mongodb-agent-ubi:107.0.12.8669-1"
137135
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_13_8702_1

helm_chart/values-openshift.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ relatedImages:
9999
- 8.0.0-ubi8
100100
- 8.0.0-ubi9
101101
agent:
102-
- 107.0.11.8645-1
103102
- 107.0.12.8669-1
104103
- 107.0.13.8702-1
105104
- 107.0.15.8741-1

public/mongodb-kubernetes-openshift.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ spec:
434434
value: "quay.io/mongodb/mongodb-kubernetes-init-ops-manager:1.2.0"
435435
- name: RELATED_IMAGE_INIT_APPDB_IMAGE_REPOSITORY_1_2_0
436436
value: "quay.io/mongodb/mongodb-kubernetes-init-appdb:1.2.0"
437-
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_11_8645_1
438-
value: "quay.io/mongodb/mongodb-agent-ubi:107.0.11.8645-1"
439437
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_12_8669_1
440438
value: "quay.io/mongodb/mongodb-agent-ubi:107.0.12.8669-1"
441439
- name: RELATED_IMAGE_AGENT_IMAGE_107_0_13_8702_1

release.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@
117117
"agent_version": "12.0.35.7911-1",
118118
"tools_version": "100.10.0"
119119
},
120-
"7.0.11": {
121-
"agent_version": "107.0.11.8645-1",
122-
"tools_version": "100.10.0"
123-
},
124120
"7.0.12": {
125121
"agent_version": "107.0.12.8669-1",
126122
"tools_version": "100.10.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeou pipefail
4+
5+
script_name=$(readlink -f "${BASH_SOURCE[0]}")
6+
script_dir=$(dirname "${script_name}")
7+
8+
source "${script_dir}/root-context"
9+
10+
export preflight_submit=true

scripts/dev/contexts/variables/om60

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export CUSTOM_OM_VERSION
1313
export CUSTOM_MDB_VERSION=6.0.21
1414
export CUSTOM_MDB_PREV_VERSION=5.0.7
1515

16-
export AGENT_VERSION=12.0.33.7866-1
16+
export AGENT_VERSION=12.0.35.7911-1
1717
export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}"
1818

1919
export CUSTOM_APPDB_VERSION=6.0.21-ent

scripts/dev/contexts/variables/om70

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export CUSTOM_OM_VERSION
1313
export CUSTOM_MDB_VERSION=7.0.18
1414
export CUSTOM_MDB_PREV_VERSION=6.0.21
1515

16-
export AGENT_VERSION=107.0.11.8645-1
16+
export AGENT_VERSION=107.0.17.8771-1
1717
export AGENT_IMAGE="${MDB_AGENT_IMAGE_REPOSITORY}:${AGENT_VERSION}"
1818

1919
export CUSTOM_APPDB_VERSION=7.0.18-ent
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeou pipefail
4+
5+
scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel agent \
6+
--all-agents \
7+
--build-scenario manual_release \
8+
-r quay.io/mongodb/mongodb-agent

0 commit comments

Comments
 (0)