Skip to content

Commit 009bea5

Browse files
committed
linter, reordering minkube, fix agents
1 parent 2b0e019 commit 009bea5

File tree

9 files changed

+89
-92
lines changed

9 files changed

+89
-92
lines changed

.evergreen-functions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ functions:
262262
# Configures docker authentication to ECR and RH registries.
263263
setup_building_host:
264264
- *switch_context
265+
- *python_venv
265266
- *setup_aws
266-
- *configure_docker_auth
267267
- *setup_evg_host
268-
- *python_venv
268+
- *configure_docker_auth
269269

270270
# This differs for normal evg_host as we require minikube instead of kind for
271-
# IBM machines and install aws cli via pip instead
271+
# IBM machines also install aws cli via pip instead and use podman
272272
setup_building_host_minikube:
273273
- *switch_context
274274
- command: subprocess.exec

.evergreen.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,12 @@ tasks:
432432
vars:
433433
image_name: meko-tests
434434

435-
436435
- name: build_test_image_ibm
437436
commands:
438437
- func: clone
439-
- func: setup_building_host_minikube
438+
- func: python_venv
439+
- func: setup_aws
440+
- func: download_kube_tools
440441
- func: build_multi_cluster_binary
441442
- func: build_test_image_ibm
442443

docker/mongodb-agent/Dockerfile.atomic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM registry.access.redhat.com/ubi8/ubi-minimal AS tools_downloader
22

3+
ARG TARGETPLATFORM
34
ARG mongodb_tools_url
45
ARG mongodb_tools_version_s390x
56
ARG mongodb_tools_version_ppc64le
@@ -24,6 +25,7 @@ RUN tar xfz /tools/mongodb_tools.tgz --directory /tools \
2425

2526
FROM registry.access.redhat.com/ubi8/ubi-minimal AS agent_downloader
2627

28+
ARG TARGETPLATFORM
2729
ARG mongodb_agent_url
2830
ARG mongodb_agent_version_s390x
2931
ARG mongodb_agent_version_ppc64le

scripts/dev/configure_container_auth.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ setup_validate_container_runtime() {
3636
;;
3737
esac
3838

39-
if [[ "$USE_SUDO" == "true" ]]; then
39+
if [[ "${USE_SUDO}" == "true" ]]; then
4040
sudo mkdir -p "$(dirname "${CONFIG_PATH}")"
4141
else
4242
mkdir -p "$(dirname "${CONFIG_PATH}")"
@@ -45,8 +45,8 @@ setup_validate_container_runtime() {
4545

4646
# Wrapper function to execute commands with or without sudo
4747
exec_cmd() {
48-
if [[ "$USE_SUDO" == "true" ]]; then
49-
sudo env PATH="$PATH" "$@"
48+
if [[ "${USE_SUDO}" == "true" ]]; then
49+
sudo env PATH="${PATH}" "$@"
5050
else
5151
"$@"
5252
fi
@@ -55,21 +55,21 @@ exec_cmd() {
5555
# Wrapper function to read files with or without sudo
5656
read_file() {
5757
local file="$1"
58-
if [[ "$USE_SUDO" == "true" ]]; then
59-
sudo cat "$file"
58+
if [[ "${USE_SUDO}" == "true" ]]; then
59+
sudo cat "${file}"
6060
else
61-
cat "$file"
61+
cat "${file}"
6262
fi
6363
}
6464

6565
# Wrapper function to write files with or without sudo
6666
write_file() {
6767
local content="$1"
6868
local file="$2"
69-
if [[ "$USE_SUDO" == "true" ]]; then
70-
echo "$content" | sudo tee "$file" > /dev/null
69+
if [[ "${USE_SUDO}" == "true" ]]; then
70+
echo "${content}" | sudo tee "${file}" > /dev/null
7171
else
72-
echo "$content" > "$file"
72+
echo "${content}" > "${file}"
7373
fi
7474
}
7575

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/usr/bin/env bash
22
source scripts/dev/set_env_context.sh
33

4+
# we need to use podman here and a special script as ibm machines don't have docker
5+
46
cp -rf public docker/mongodb-kubernetes-tests/public
57
cp release.json docker/mongodb-kubernetes-tests/release.json
68
cp requirements.txt docker/mongodb-kubernetes-tests/requirements.txt
79
cp -rf helm_chart docker/mongodb-kubernetes-tests/helm_chart
810

911
echo "Building mongodb-kubernetes-tests image with tag: ${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}"
1012
cd docker/mongodb-kubernetes-tests
11-
#sudo podman buildx build --progress plain . -f Dockerfile -t "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" --build-arg PYTHON_VERSION="${PYTHON_VERSION}"
12-
#sudo podman push --authfile="/root/.config/containers/auth.json" "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)"
13-
docker buildx build --progress plain . -f Dockerfile -t "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" --build-arg PYTHON_VERSION="${PYTHON_VERSION}"
14-
docker push "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)"
13+
sudo podman buildx build --progress plain . -f Dockerfile -t "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)" --build-arg PYTHON_VERSION="${PYTHON_VERSION}"
14+
sudo podman push --authfile="/root/.config/containers/auth.json" "${BASE_REPO_URL}/mongodb-kubernetes-tests:${version_id}-$(arch)"
1515

1616
# docker buildx imagetools create "${BASE_REPO_URL}mongodb-kubernetes-tests:${version_id}" --append "${BASE_REPO_URL}mongodb-kubernetes-tests:${version_id}-$(arch)" -t "${BASE_REPO_URL}mongodb-kubernetes-tests:${version_id}"

scripts/evergreen/setup_kind.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ arch_suffix=$(detect_architecture)
1111
# This should be changed when needed
1212
latest_version="v0.27.0"
1313

14-
mkdir -p "${PROJECT_DIR}/bin/"
15-
echo "Saving kind to ${PROJECT_DIR}/bin"
16-
curl --retry 3 --silent -L "https://github.com/kubernetes-sigs/kind/releases/download/${latest_version}/kind-${os}-${arch_suffix}" -o kind
14+
# Only proceed with installation if architecture is supported (amd64 or arm64)
15+
if [[ "$arch_suffix" == "amd64" || "$arch_suffix" == "arm64" ]]; then
16+
mkdir -p "${PROJECT_DIR}/bin/"
17+
echo "Saving kind to ${PROJECT_DIR}/bin"
18+
curl --retry 3 --silent -L "https://github.com/kubernetes-sigs/kind/releases/download/${latest_version}/kind-${os}-${arch_suffix}" -o kind
1719

18-
chmod +x kind
19-
sudo mv kind "${PROJECT_DIR}/bin"
20-
echo "Installed kind in ${PROJECT_DIR}/bin"
20+
chmod +x kind
21+
sudo mv kind "${PROJECT_DIR}/bin"
22+
echo "Installed kind in ${PROJECT_DIR}/bin"
23+
else
24+
echo "Architecture ${arch_suffix} not supported for kind installation, skipping"
25+
fi

scripts/evergreen/setup_minikube_host.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
source scripts/dev/set_env_context.sh
88
source scripts/funcs/install
9-
set -Eeoux pipefail
9+
set -Eeou pipefail
1010

1111
echo "=========================================="
1212
echo "Setting up minikube host with multi-architecture support"
@@ -39,7 +39,6 @@ run_setup_step() {
3939
}
4040

4141
# Setup Python environment (needed for AWS CLI pip installation)
42-
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
4342
export SKIP_INSTALL_REQUIREMENTS=true
4443
run_setup_step "Python Virtual Environment" "scripts/dev/recreate_python_venv.sh"
4544

@@ -54,14 +53,9 @@ run_setup_step "Minikube Host Setup with Container Runtime Detection" "scripts/m
5453
export CONTAINER_RUNTIME=podman
5554
run_setup_step "Container Registry Authentication" "scripts/dev/configure_container_auth.sh"
5655

57-
# The minikube cluster is already started by the setup_minikube_host.sh script
58-
echo ""
59-
echo ">>> Minikube cluster startup completed by setup_minikube_host.sh"
60-
echo "✅ Minikube cluster is ready for use"
61-
6256
echo ""
6357
echo "=========================================="
64-
echo "Minikube host setup completed successfully!"
58+
echo "✅ host setup completed successfully!"
6559
echo "=========================================="
6660
echo ""
6761
echo "Installed tools summary:"
@@ -70,7 +64,5 @@ echo "- AWS CLI: $(aws --version 2>/dev/null || echo 'Not found')"
7064
echo "- kubectl: $(kubectl version --client 2>/dev/null || echo 'Not found')"
7165
echo "- helm: $(helm version --short 2>/dev/null || echo 'Not found')"
7266
echo "- jq: $(jq --version 2>/dev/null || echo 'Not found')"
73-
echo "- Container Runtime: $(command -v podman &>/dev/null && echo "Podman $(podman --version 2>/dev/null)" || command -v docker &>/dev/null && echo "Docker $(docker --version 2>/dev/null)" || echo "Not found")"
74-
echo "- Minikube: $(./bin/minikube version --short 2>/dev/null || echo 'Not found')"
7567
echo ""
76-
echo "Setup complete! Host is ready for minikube operations."
68+
echo "Setup complete! Host is ready for operations."

scripts/release/atomic_pipeline.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ def get_build_arg_names(platform: str) -> Dict[str, str]:
6464
# Extract architecture from platform (e.g., "amd64" from "linux/amd64")
6565
arch = platform.split("/")[1]
6666

67-
return {
68-
"agent_build_arg": f"mongodb_agent_version_{arch}",
69-
"tools_build_arg": f"mongodb_tools_version_{arch}"
70-
}
67+
return {"agent_build_arg": f"mongodb_agent_version_{arch}", "tools_build_arg": f"mongodb_tools_version_{arch}"}
7168

7269

7370
def generate_tools_build_args(platforms: List[str], tools_version: str) -> Dict[str, str]:
@@ -346,14 +343,13 @@ def build_init_appdb_image(build_configuration: ImageBuildConfiguration):
346343
# Extract tools version and generate platform-specific build args
347344
tools_version = extract_tools_version_from_release(release)
348345
platform_build_args = generate_tools_build_args(
349-
platforms=build_configuration.platforms,
350-
tools_version=tools_version
346+
platforms=build_configuration.platforms, tools_version=tools_version
351347
)
352348

353349
args = {
354350
"version": build_configuration.version,
355351
"mongodb_tools_url": base_url, # Base URL for platform-specific downloads
356-
**platform_build_args # Add the platform-specific build args
352+
**platform_build_args, # Add the platform-specific build args
357353
}
358354

359355
build_image(
@@ -372,14 +368,13 @@ def build_init_database_image(build_configuration: ImageBuildConfiguration):
372368
# Extract tools version and generate platform-specific build args
373369
tools_version = extract_tools_version_from_release(release)
374370
platform_build_args = generate_tools_build_args(
375-
platforms=build_configuration.platforms,
376-
tools_version=tools_version
371+
platforms=build_configuration.platforms, tools_version=tools_version
377372
)
378373

379374
args = {
380375
"version": build_configuration.version,
381376
"mongodb_tools_url": base_url, # Add the base URL for the Dockerfile
382-
**platform_build_args # Add the platform-specific build args
377+
**platform_build_args, # Add the platform-specific build args
383378
}
384379

385380
build_image(
@@ -520,14 +515,7 @@ def _build_agent(
520515
agent_version = agent_tools_version[0]
521516
tools_version = agent_tools_version[1]
522517

523-
tasks_queue.put(
524-
executor.submit(
525-
build_agent_pipeline,
526-
build_configuration,
527-
agent_version,
528-
tools_version
529-
)
530-
)
518+
tasks_queue.put(executor.submit(build_agent_pipeline, build_configuration, agent_version, tools_version))
531519

532520

533521
def build_agent_pipeline(
@@ -543,20 +531,20 @@ def build_agent_pipeline(
543531

544532
# Generate platform-specific build arguments using the mapping
545533
platform_build_args = generate_agent_build_args(
546-
platforms=build_configuration.platforms,
547-
agent_version=agent_version,
548-
tools_version=tools_version
534+
platforms=build_configuration.platforms, agent_version=agent_version, tools_version=tools_version
549535
)
550536

551-
agent_base_url = "https://mciuploads.s3.amazonaws.com/mms-automation/mongodb-mms-build-agent/builds/automation-agent/prod"
537+
agent_base_url = (
538+
"https://mciuploads.s3.amazonaws.com/mms-automation/mongodb-mms-build-agent/builds/automation-agent/prod"
539+
)
552540
tools_base_url = "https://fastdl.mongodb.org/tools/db"
553541

554542
args = {
555543
"version": agent_version,
556544
"agent_version": agent_version,
557545
"mongodb_agent_url": agent_base_url,
558546
"mongodb_tools_url": tools_base_url,
559-
**platform_build_args # Add the platform-specific build args
547+
**platform_build_args, # Add the platform-specific build args
560548
}
561549

562550
build_image(

0 commit comments

Comments
 (0)