Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .evergreen-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -517,30 +517,36 @@ functions:
# docker buildx needs the moby/buildkit image when setting up a builder so we pull it from our mirror
docker buildx create --driver=docker-container --driver-opt=image=268558157000.dkr.ecr.eu-west-1.amazonaws.com/docker-hub-mirrors/moby/buildkit:buildx-stable-1 --use
docker buildx inspect --bootstrap
- command: ec2.assume_role
display_name: Assume IAM role with permissions to pull Kondukto API token
- command: subprocess.exec
retry_on_failure: true
type: setup
params:
role_arn: ${kondukto_role_arn}
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}

release_pipeline:
- *switch_context
- command: shell.exec
display_name: Pull Kondukto API token from AWS Secrets Manager and write it to file
type: setup
params:
silent: true
shell: bash
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
script: |
set -e
# use AWS CLI to get the Kondukto API token from AWS Secrets Manager
kondukto_token=$(aws secretsmanager get-secret-value --secret-id "kondukto-token" --region "us-east-1" --query 'SecretString' --output text)
# write the KONDUKTO_TOKEN environment variable to Silkbomb environment file
echo "KONDUKTO_TOKEN=$kondukto_token" > ${workdir}/silkbomb.env
# Docker Hub workaround
# docker buildx needs the moby/buildkit image when setting up a builder so we pull it from our mirror
docker buildx create --driver=docker-container --driver-opt=image=268558157000.dkr.ecr.eu-west-1.amazonaws.com/docker-hub-mirrors/moby/buildkit:buildx-stable-1 --use
docker buildx inspect --bootstrap
- 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/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name}
env:
git_tag: ${triggered_by_git_tag}
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py ${image_name} --build-scenario release --version ${git_tag}

# TODO: CLOUDP-335471 ; once all image builds are made with the new atomic pipeline, remove the following function
legacy_pipeline:
Expand Down
100 changes: 18 additions & 82 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ variables:
variant: init_test_run
- name: build_test_image
variant: init_test_run
- name: build_agent_images_ubi
variant: init_test_run
- name: build_readiness_probe_image
variant: init_test_run
- name: build_upgrade_hook_image
variant: init_test_run
- name: build_mco_test_image
variant: init_test_run
- name: build_agent_images_ubi
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still use all run this on every patch, the script just checks whether its required and potentially skips it then if there are no changes.

Why still run it?
On CM and OM bump prs we still need the agent in ecr first. This ensures we build it to ecr first

variant: init_test_run

- &setup_group
setup_group_can_fail_task: true
Expand Down Expand Up @@ -347,19 +347,6 @@ tasks:
image_name: init-ops-manager
include_tags: release

- name: release_agent_operator_release
tags: [ "image_release" ]
allowed_requesters: [ "patch", "github_tag" ]
commands:
- func: clone
- func: setup_building_host
- func: quay_login
- func: setup_docker_sbom
- func: legacy_pipeline
vars:
image_name: agent
include_tags: release

# pct only triggers this variant once a new agent image is out
- name: release_agent
# this enables us to run this variant either manually (patch) which pct does or during an OM bump (github_pr)
Expand All @@ -369,10 +356,9 @@ tasks:
- func: setup_building_host
- func: quay_login
- func: setup_docker_sbom
- func: legacy_pipeline
- func: release_pipeline
vars:
image_name: agent-pct
include_tags: release
image_name: agent

- name: run_precommit_and_push
tags: ["patch-run"]
Expand All @@ -392,48 +378,17 @@ tasks:
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/evergreen/precommit_bump.sh

# Pct only triggers this variant once a new agent image is out
# these releases the agent with the operator suffix (not patch id) on ecr to allow for digest pinning to pass.
# For this to work, we rely on skip_tags which is used to determine whether
# we want to release on quay or not, in this case - ecr instead.
# We rely on the init_database from ecr for the agent x operator images.
# This runs on agent releases that are not concurrent with operator releases.
- name: release_agents_on_ecr_conditional
commands:
- func: clone
- func: run_task_conditionally
vars:
condition_script: scripts/evergreen/should_release_agents_on_ecr.sh
variant: init_release_agents_on_ecr
task: release_agents_on_ecr

- name: release_agents_on_ecr
# this enables us to run this variant either manually (patch) which pct does or during an OM bump (github_pr)
allowed_requesters: [ "patch", "github_pr" ]
priority: 70
commands:
- func: clone
- func: setup_building_host
- func: legacy_pipeline
vars:
image_name: agent-pct
skip_tags: release

- name: release_all_agents_on_ecr
# this enables us to run this manually (patch) and release all agent versions to ECR
# it's needed during operator new version release process - e2e tests (especially olm tests)
# will look for agent with new operator version suffix, but during PR checks we only build
# agent versions for most recent major OM versions and the tests will fail. Before running the PR
# we have to manually release all agents to ECR by triggering this patch
# this enables us to run this manually (patch) and release all agent versions to ECR to verify
# Dockerfile, script changes etc.
allowed_requesters: [ "patch" ]
commands:
- func: clone
- func: setup_building_host
- func: legacy_pipeline
- func: pipeline
vars:
image_name: agent-pct
skip_tags: release
all_agents: true
image_name: agent
all_agents: "--all-agents"

- name: build_test_image
commands:
Expand Down Expand Up @@ -1334,8 +1289,7 @@ buildvariants:
variant: init_test_run
- name: build_init_database_image_ubi
variant: init_test_run
- name: build_agent_images_ubi
variant: init_test_run

tasks:
- name: e2e_custom_domain_task_group

Expand Down Expand Up @@ -1369,8 +1323,7 @@ buildvariants:
variant: init_test_run
- name: build_init_database_image_ubi
variant: init_test_run
- name: build_agent_images_ubi
variant: init_test_run

run_on:
- ubuntu2204-small
tasks:
Expand Down Expand Up @@ -1594,6 +1547,8 @@ buildvariants:
variant: init_test_run
- name: prepare_and_upload_openshift_bundles_for_e2e
variant: init_tests_with_olm
- name: build_agent_images_ubi
variant: init_test_run
tasks:
- name: e2e_kind_olm_group

Expand All @@ -1619,6 +1574,7 @@ buildvariants:
variant: init_test_run
- name: build_agent_images_ubi
variant: init_test_run

tasks:
- name: e2e_kind_olm_group

Expand Down Expand Up @@ -1683,18 +1639,6 @@ buildvariants:
- name: build_upgrade_hook_image
- name: prepare_aws

- name: init_release_agents_on_ecr
display_name: init_release_agents_on_ecr
# this enables us to run this variant either manually (patch) which pct does or during an OM bump (github_pr)
allowed_requesters: [ "patch", "github_pr" ]
tags: [ "release_agents_on_ecr" ]
# We want that to run first and finish asap. Digest pinning depends on this to succeed.
priority: 70
run_on:
- ubuntu2204-large
tasks:
- name: release_agents_on_ecr_conditional

- name: run_pre_commit
priority: 70
display_name: run_pre_commit
Expand Down Expand Up @@ -1722,8 +1666,7 @@ buildvariants:
variant: init_test_run
- name: build_init_om_images_ubi
variant: init_test_run
- name: build_agent_images_ubi
variant: init_test_run

run_on:
- ubuntu2204-small
tasks:
Expand Down Expand Up @@ -1809,13 +1752,6 @@ buildvariants:
- name: release_init_database
- name: release_init_ops_manager
- name: release_database
# Once we release the operator, we will also release the init databases, we require them to be out first
# such that we can reference them and retrieve those binaries.
# Since we immediately run daily rebuild after creating the image, we can ensure that the init_database is out
# such that the agent image build can use it.
- name: release_agent_operator_release
depends_on:
- name: release_init_database

- name: preflight_release_images
display_name: preflight_release_images
Expand Down Expand Up @@ -1847,13 +1783,13 @@ buildvariants:

# It will be called by pct while bumping the agent cloud manager image
- name: release_agent
display_name: (Static Containers) Release Agent matrix
display_name: release_agent
tags: [ "release_agent" ]
run_on:
- release-ubuntu2204-large # This is required for CISA attestation https://jira.mongodb.org/browse/DEVPROD-17780
depends_on:
- variant: init_release_agents_on_ecr
name: '*'
- variant: init_test_run
name: build_agent_images_ubi # this ensures the agent gets released to ECR as well
- variant: e2e_multi_cluster_kind
name: '*'
- variant: e2e_static_multi_cluster_2_clusters
Expand Down
Loading