Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[single-machine-performance] Push agent containers to SMP ECR #14477

Merged
merged 5 commits into from
Nov 29, 2022
Merged
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions .gitlab/container_build/docker_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,42 @@ docker_build_agent7:
TEST_IMG: "true"
BUILD_ARG: --target release --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent_7*_amd64.deb

# NOTE this is a temporary workaround and the method taken in #14438 is
# preferred in the long-term.
docker_build_agent7_single_machine_performance:
rules:
!reference [.on_a7]
needs:
- job: agent_deb-x64-a7
artifacts: false
script:
- aws s3 sync --only-show-errors $S3_ARTIFACTS_URI Dockerfiles/agent
# Setup AWS credentials for single-machine-performance AWS account
- SMP_ACCOUNT_ID=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.single-machine-performance-account-id --with-decryption --query "Parameter.Value" --out text)
- SMP_ECR_URL=${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
- SMP_AGENT_TEAM_ID=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.single-machine-performance-agent-team-id --with-decryption --query "Parameter.Value" --out text)
- aws configure set aws_access_key_id $(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.single-machine-performance-bot-access-key-id --with-decryption --query "Parameter.Value" --out text) --profile single-machine-performance
- aws configure set aws_secret_access_key $(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.single-machine-performance-bot-access-key --with-decryption --query "Parameter.Value" --out text) --profile single-machine-performance
- aws configure set region us-west-2 --profile single-machine-performance
# Login to Single Machine Performance ECR
- aws ecr get-login-password --profile single-machine-performance | docker login --username "AWS" --password-stdin "$SMP_ECR_URL"
# Calculate SMP tag, note that it must be deterministic and able to be
# computed across pipeline executions.
- TARGET_TAG=${SMP_ECR_URL}/${SMP_AGENT_TEAM_ID}-agent:${CI_COMMIT_SHA}-7-amd64
# DockerHub login for build to limit rate limit when pulling base images
- DOCKER_REGISTRY_LOGIN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.$DOCKER_REGISTRY_LOGIN_SSM_KEY --with-decryption --query "Parameter.Value" --out text)
- aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.$DOCKER_REGISTRY_PWD_SSM_KEY --with-decryption --query "Parameter.Value" --out text | docker login --username "$DOCKER_REGISTRY_LOGIN" --password-stdin "$DOCKER_REGISTRY_URL"
# Pull base images
- inv -e docker.pull-base-images Dockerfiles/agent/amd64/Dockerfile
# Build image
- docker build --build-arg CIBUILD=true --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL} --target release --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent_7*_amd64.deb --file $BUILD_CONTEXT/$ARCH/Dockerfile --tag ${TARGET_TAG}-unsquashed $BUILD_CONTEXT
# Squash image, test, and push to ECR
- docker-squash ${TARGET_TAG}-unsquashed -t ${TARGET_TAG}
- test "true" && docker run -v `pwd`/Dockerfiles/agent:/tmp/build ${TARGET_TAG} python /tmp/build/test_image_contents.py
- docker push $TARGET_TAG
# Workaround for temporary network failures
retry: 2

docker_build_agent7_arm64:
extends: .docker_build_job_definition_arm64
rules:
Expand Down