Skip to content

Commit 7b469c6

Browse files
authored
CLOUDP-339241 - Improve e2e on arm (#515)
# Summary This PR adds a new task running on arm64 to build the arm64 test image. Previously it was built using emulation on an amd64 resulting in a runtime of ~40 minutes. ## Proof of Work CI is green [Smoke test on ARM](https://spruce.mongodb.com/version/68ee6adf9eafcd00078b8b26/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC) also green ## 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 67fe13f commit 7b469c6

File tree

12 files changed

+104
-24
lines changed

12 files changed

+104
-24
lines changed

.evergreen-functions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ functions:
527527
binary: scripts/release/pipeline.sh
528528
env:
529529
IMAGE_NAME: ${IMAGE_NAME}
530+
FLAGS: ${FLAGS}
530531

531532
pipeline_agent:
532533
- command: subprocess.exec

.evergreen.yml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ tasks:
351351
vars:
352352
IMAGE_NAME: meko-tests
353353

354+
- name: build_test_image_arm
355+
commands:
356+
- func: clone
357+
- func: setup_building_host
358+
- func: build_multi_cluster_binary
359+
- func: pipeline
360+
vars:
361+
IMAGE_NAME: meko-tests-arm64
362+
363+
354364
- name: build_test_image_ibm
355365
commands:
356366
- func: clone
@@ -1386,10 +1396,6 @@ buildvariants:
13861396
variant: init_test_run
13871397
- name: build_database_image_ubi
13881398
variant: init_test_run
1389-
- name: build_init_appdb_images_ubi
1390-
variant: init_test_run
1391-
- name: build_init_om_images_ubi
1392-
variant: init_test_run
13931399
- name: build_test_image_ibm
13941400
variant: init_test_run_ibm_power
13951401
tasks:
@@ -1412,10 +1418,6 @@ buildvariants:
14121418
variant: init_test_run
14131419
- name: build_database_image_ubi
14141420
variant: init_test_run
1415-
- name: build_init_appdb_images_ubi
1416-
variant: init_test_run
1417-
- name: build_init_om_images_ubi
1418-
variant: init_test_run
14191421
- name: build_test_image_ibm
14201422
variant: init_test_run_ibm_power
14211423
tasks:
@@ -1438,10 +1440,6 @@ buildvariants:
14381440
variant: init_test_run
14391441
- name: build_database_image_ubi
14401442
variant: init_test_run
1441-
- name: build_init_appdb_images_ubi
1442-
variant: init_test_run
1443-
- name: build_init_om_images_ubi
1444-
variant: init_test_run
14451443
- name: build_test_image_ibm
14461444
variant: init_test_run_ibm_z
14471445
tasks:
@@ -1462,12 +1460,6 @@ buildvariants:
14621460
variant: init_test_run
14631461
- name: build_init_database_image_ubi
14641462
variant: init_test_run
1465-
- name: build_database_image_ubi
1466-
variant: init_test_run
1467-
- name: build_init_appdb_images_ubi
1468-
variant: init_test_run
1469-
- name: build_init_om_images_ubi
1470-
variant: init_test_run
14711463
- name: build_test_image_ibm
14721464
variant: init_test_run_ibm_z
14731465
tasks:
@@ -1479,10 +1471,18 @@ buildvariants:
14791471
run_on:
14801472
- ubuntu2404-arm64-large
14811473
allowed_requesters: [ "patch", "commit" ]
1474+
depends_on:
1475+
- name: build_operator_ubi
1476+
variant: init_test_run
1477+
- name: build_init_database_image_ubi
1478+
variant: init_test_run
1479+
- name: build_database_image_ubi
1480+
variant: init_test_run
1481+
- name: build_test_image_arm
1482+
variant: init_test_run_arm
14821483
# TODO: Re-enable when staging is added to pipeline
14831484
# https://jira.mongodb.org/browse/CLOUDP-349096
14841485
disable: true
1485-
<<: *base_no_om_image_dependency
14861486
tasks:
14871487
- name: e2e_smoke_arm_task_group
14881488

@@ -1492,10 +1492,16 @@ buildvariants:
14921492
run_on:
14931493
- ubuntu2404-arm64-large
14941494
allowed_requesters: [ "patch", "commit" ]
1495+
depends_on:
1496+
- name: build_operator_ubi
1497+
variant: init_test_run
1498+
- name: build_init_database_image_ubi
1499+
variant: init_test_run
1500+
- name: build_test_image_arm
1501+
variant: init_test_run_arm
14951502
# TODO: Re-enable when staging is added to pipeline
14961503
# https://jira.mongodb.org/browse/CLOUDP-349096
14971504
disable: true
1498-
<<: *base_no_om_image_dependency
14991505
tasks:
15001506
- name: e2e_smoke_arm_task_group
15011507

@@ -1727,6 +1733,15 @@ buildvariants:
17271733
tasks:
17281734
- name: build_test_image_ibm
17291735

1736+
- name: init_test_run_arm
1737+
display_name: init_test_run_arm
1738+
max_hosts: -1
1739+
tags: [ "staging" ]
1740+
run_on:
1741+
- ubuntu2204-arm64-small
1742+
tasks:
1743+
- name: build_test_image_arm
1744+
17301745
- name: run_pre_commit
17311746
priority: 70
17321747
display_name: run_pre_commit

build_info.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
"staging": {
181181
"repositories": ["268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-tests"],
182182
"platforms": [
183-
"linux/arm64",
184183
"linux/amd64"
185184
]
186185
},
@@ -192,6 +191,27 @@
192191
]
193192
}
194193
},
194+
"meko-tests-arm64": {
195+
"dockerfile-path": "docker/mongodb-kubernetes-tests/Dockerfile",
196+
"patch": {
197+
"repositories": [
198+
"268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-tests"
199+
],
200+
"platforms": [
201+
"linux/arm64"
202+
],
203+
"architecture_suffix": true
204+
},
205+
"staging": {
206+
"repositories": [
207+
"268558157000.dkr.ecr.us-east-1.amazonaws.com/staging/mongodb-kubernetes-tests"
208+
],
209+
"platforms": [
210+
"linux/arm64"
211+
],
212+
"architecture_suffix": true
213+
}
214+
},
195215
"mco-tests": {
196216
"dockerfile-path": "docker/mongodb-community-tests/Dockerfile",
197217
"patch": {

scripts/dev/setup_evg_host.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ download_kind() {
4747
download_kubectl() {
4848
kubectl_version=$(curl --retry 5 -Ls https://dl.k8s.io/release/stable.txt)
4949
echo "Downloading kubectl ${kubectl_version}..."
50+
kubectl_version=$(echo "${kubectl_version}" | tail -n1 | tr -d '\n')
5051

5152
curl --retry 5 -LOs "https://dl.k8s.io/release/${kubectl_version}/bin/linux/${ARCH}/kubectl"
5253
chmod +x kubectl

scripts/evergreen/e2e/single_e2e.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ deploy_test_app() {
2828
arch=$(uname -m)
2929

3030
case "${arch}" in
31+
aarch64|arm64)
32+
meko_tests_version="${meko_tests_version}-arm64"
33+
;;
3134
ppc64le)
3235
meko_tests_version="${meko_tests_version}-ppc64le"
3336
;;
3437
s390x)
3538
meko_tests_version="${meko_tests_version}-s390x"
3639
;;
3740
*)
38-
echo "Not IBM host, using default meko_tests_version"
41+
echo "amd64 host, using default meko_tests_version"
3942
;;
4043
esac
4144

scripts/evergreen/setup_kubectl.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ mkdir -p "${bindir}" "${tmpdir}"
1414

1515
kubectl_version=$(curl --retry 5 -Ls https://dl.k8s.io/release/stable.txt)
1616
echo "Downloading kubectl ${kubectl_version} for ${ARCH}"
17+
kubectl_version=$(echo "${kubectl_version}" | tail -n1 | tr -d '\n')
1718

1819
curl --retry 5 -LOs "https://dl.k8s.io/release/${kubectl_version}/bin/linux/${ARCH}/kubectl"
1920
chmod +x kubectl

scripts/release/atomic_pipeline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ def build_image(
8787
if build_configuration.olm_tag:
8888
olm_tag = create_olm_version_tag(build_configuration.version)
8989
tags.append(f"{registry}:{olm_tag}")
90+
if build_configuration.architecture_suffix and len(build_configuration.platforms) == 1:
91+
arch = build_configuration.platforms[0].split("/")[1]
92+
tags.append(f"{tag}-{arch}")
9093

9194
if not tags:
9295
logger.info("All specified image tags already exist. Skipping build.")

scripts/release/build/build_info.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from scripts.release.build.build_scenario import BuildScenario
66

77
MEKO_TESTS_IMAGE = "meko-tests"
8+
MEKO_TESTS_ARM64_IMAGE = "meko-tests-arm64"
89
OPERATOR_IMAGE = "operator"
910
OPERATOR_RACE_IMAGE = "operator-race"
1011
MCO_TESTS_IMAGE = "mco-tests"
@@ -27,6 +28,7 @@ class ImageInfo:
2728
latest_tag: bool = False
2829
olm_tag: bool = False
2930
skip_if_exists: bool = False
31+
architecture_suffix: bool = False
3032

3133

3234
@dataclass
@@ -80,6 +82,7 @@ def load_build_info(scenario: BuildScenario) -> BuildInfo:
8082
latest_tag=scenario_data.get("latest-tag", False),
8183
olm_tag=scenario_data.get("olm-tag", False),
8284
skip_if_exists=scenario_data.get("skip-if-exists", False),
85+
architecture_suffix=scenario_data.get("architecture_suffix", False),
8386
)
8487

8588
binaries = {}

scripts/release/build/image_build_configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ImageBuildConfiguration:
2323
parallel_factor: int = 0
2424
all_agents: bool = False
2525
currently_used_agents: bool = False
26+
architecture_suffix: bool = False
2627

2728
def is_release_scenario(self) -> bool:
2829
return self.scenario == BuildScenario.RELEASE

scripts/release/pipeline.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
INIT_DATABASE_IMAGE,
3838
INIT_OPS_MANAGER_IMAGE,
3939
MCO_TESTS_IMAGE,
40+
MEKO_TESTS_ARM64_IMAGE,
4041
MEKO_TESTS_IMAGE,
4142
OPERATOR_IMAGE,
4243
OPERATOR_RACE_IMAGE,
@@ -69,6 +70,7 @@ def get_builder_function_for_image_name() -> Dict[str, Callable]:
6970

7071
image_builders = {
7172
MEKO_TESTS_IMAGE: build_meko_tests_image,
73+
MEKO_TESTS_ARM64_IMAGE: build_meko_tests_image,
7274
OPERATOR_IMAGE: build_operator_image,
7375
OPERATOR_RACE_IMAGE: partial(build_operator_image, with_race_detection=True),
7476
MCO_TESTS_IMAGE: build_mco_tests_image,
@@ -120,6 +122,12 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration:
120122
platforms = get_platforms_from_arg(args.platform) or image_build_info.platforms
121123
sign = args.sign if args.sign is not None else image_build_info.sign
122124
skip_if_exists = args.skip_if_exists if args.skip_if_exists is not None else image_build_info.skip_if_exists
125+
architecture_suffix = (
126+
args.architecture_suffix if args.architecture_suffix is not None else image_build_info.architecture_suffix
127+
)
128+
129+
if architecture_suffix and len(platforms) > 1:
130+
raise ValueError("Cannot use architecture suffix with multi-platform builds")
123131

124132
# Validate version - only agent can have None version as the versions are managed by the agent
125133
# which are externally retrieved from release.json
@@ -140,6 +148,7 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration:
140148
parallel_factor=args.parallel_factor,
141149
all_agents=args.all_agents,
142150
currently_used_agents=args.current_agents,
151+
architecture_suffix=architecture_suffix,
143152
)
144153

145154

@@ -283,6 +292,11 @@ def main():
283292
action="store_true",
284293
help="Build all currently used agent images.",
285294
)
295+
parser.add_argument(
296+
"--architecture-suffix",
297+
action=argparse.BooleanOptionalAction,
298+
help="Append architecture suffix to image tags for single platform builds. Can be true or false. This will override the value from build_info.json",
299+
)
286300

287301
args = parser.parse_args()
288302

0 commit comments

Comments
 (0)