[ACIX-1309] Try internal registry first for base Docker images used for fakeintake#46521
Conversation
| ## Based on https://docs.docker.com/language/golang/build-images/ | ||
| # syntax=docker/dockerfile:1 | ||
| ARG BASE_IMAGE_REGISTRY=docker.io | ||
| ARG GO_VERSION=1.25.7 |
There was a problem hiding this comment.
If it's an arg, could we just pass it from the build job ? (entirely removing the need to update this file on go updates)
There was a problem hiding this comment.
Sure we could, but as a rule of thumb I prefer to keep versions inside the Dockerfile themselves, or in a centralized place like a bake file. Needing to pass them via CLI makes the docker build command very clunky in case you ever want to build the image locally (this was especially painful when I was working on buildimages, where the command had 20+ args 🥴)
Gitlab CI Configuration ChangesModified Jobsdocker_build_fakeintake docker_build_fakeintake:
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:20.10-py3
needs: []
retry: 2
rules:
- if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/
when: never
- changes:
compare_to: $COMPARE_TO_BRANCH
paths:
- test/fakeintake/**/*
- .gitlab/build/binary_build/fakeintake.yml
- .gitlab/deploy/container_build/fakeintake.yml
- .gitlab/deploy/dev_container_deploy/fakeintake.yml
- changes:
paths:
- test/fakeintake/**/*
- .gitlab/build/binary_build/fakeintake.yml
- .gitlab/deploy/container_build/fakeintake.yml
- .gitlab/deploy/dev_container_deploy/fakeintake.yml
if: $CI_COMMIT_BRANCH == "main"
script:
+ - "GO_VERSION=$(grep -E '^ARG GO_VERSION=' ${DOCKERFILE} | cut -d= -f2)\nGOLANG_IMAGE=\"\
+ ${BASE_IMAGE_REGISTRY}/library/golang:${GO_VERSION}\"\nif docker buildx imagetools\
+ \ inspect \"${GOLANG_IMAGE}\" > /dev/null 2>&1; then\n echo \"Base image ${GOLANG_IMAGE}\
+ \ found in internal registry, building...\"\n docker buildx build --push --pull\
+ \ --platform ${PLATFORMS} --build-arg=CI --build-arg=BASE_IMAGE_REGISTRY=${BASE_IMAGE_REGISTRY}\
+ \ --file ${DOCKERFILE} --tag ${TARGET} $BUILD_CONTEXT\n exit 0\nfi\n"
- DOCKER_LOGIN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $DOCKER_REGISTRY_RO user)
|| exit $?
- $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $DOCKER_REGISTRY_RO token | docker login
--username "$DOCKER_LOGIN" --password-stdin "$DOCKER_REGISTRY_URL"
- EXIT="${PIPESTATUS[0]}"; if [ $EXIT -ne 0 ]; then echo "Unable to locate credentials
needs gitlab runner restart"; exit $EXIT; fi
+ - 'echo "Base image ${GOLANG_IMAGE} not found in internal registry, falling back
+ to docker.io..."
+
- - docker buildx build --push --pull --platform ${PLATFORMS} --build-arg=CI --file
? ^ ^
+ docker buildx build --push --pull --platform ${PLATFORMS} --build-arg=CI --build-arg=BASE_IMAGE_REGISTRY=docker.io
? ^ ^^ ++++++++++++++++++++++++++++++ ++++
- ${DOCKERFILE} --tag ${TARGET} $BUILD_CONTEXT
+ --file ${DOCKERFILE} --tag ${TARGET} $BUILD_CONTEXT
? +++++++
+
+ '
stage: container_build
tags:
- arch:amd64
- specific:true
variables:
+ BASE_IMAGE_REGISTRY: registry.ddbuild.io/images/mirror
BUILD_CONTEXT: .
DOCKERFILE: test/fakeintake/Dockerfile
PLATFORMS: linux/amd64,linux/arm64
TARGET: registry.ddbuild.io/ci/datadog-agent/fakeintake:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}Changes Summary
ℹ️ Diff available in the job log. |
There was a problem hiding this comment.
Pull request overview
Updates the fakeintake container build to prefer pulling base images from the internal mirror registry first (with a fallback to Docker Hub), and aligns the Go version update automation with the new Dockerfile pattern to improve CI reliability.
Changes:
- Parameterize fakeintake base images via
BASE_IMAGE_REGISTRYandGO_VERSIONbuild args. - Update
update-goautomation to bump theGO_VERSION=arg in the fakeintake Dockerfile. - Add CI build retry/fallback logic to rebuild using
docker.ioif the internal mirror is missing the required base image.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
test/fakeintake/Dockerfile |
Adds registry/version args and switches base images to use an internal registry prefix. |
tasks/update_go.py |
Updates the Go version reference matcher to target GO_VERSION= in the fakeintake Dockerfile. |
.gitlab/deploy/container_build/fakeintake.yml |
Tries internal mirror first and retries build with docker.io when base image resolution fails. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Static quality checks✅ Please find below the results from static quality gates 31 successful checks with minimal change (< 2 KiB)
On-wire sizes (compressed)
|
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: cafb445 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | +0.44 | [-2.68, +3.57] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gate_metrics_logs | memory utilization | +1.67 | [+1.47, +1.87] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_logs | % cpu utilization | +0.53 | [-0.99, +2.05] | 1 | Logs bounds checks dashboard |
| ➖ | docker_containers_cpu | % cpu utilization | +0.44 | [-2.68, +3.57] | 1 | Logs |
| ➖ | docker_containers_memory | memory utilization | +0.43 | [+0.35, +0.51] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | +0.39 | [+0.23, +0.54] | 1 | Logs |
| ➖ | file_tree | memory utilization | +0.27 | [+0.22, +0.32] | 1 | Logs |
| ➖ | quality_gate_idle | memory utilization | +0.25 | [+0.21, +0.29] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_logs | memory utilization | +0.25 | [+0.18, +0.32] | 1 | Logs |
| ➖ | ddot_metrics_sum_delta | memory utilization | +0.07 | [-0.12, +0.26] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | +0.07 | [-0.09, +0.23] | 1 | Logs |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | +0.07 | [-0.31, +0.44] | 1 | Logs |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | +0.01 | [-0.49, +0.50] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.13, +0.13] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.10, +0.09] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_v3 | ingress throughput | -0.00 | [-0.13, +0.12] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | -0.03 | [-0.45, +0.39] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | -0.03 | [-0.08, +0.02] | 1 | Logs |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | -0.08 | [-0.13, -0.03] | 1 | Logs |
| ➖ | ddot_metrics | memory utilization | -0.10 | [-0.30, +0.11] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | -0.17 | [-0.21, -0.14] | 1 | Logs bounds checks dashboard |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | -0.38 | [-0.45, -0.32] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | -0.46 | [-0.69, -0.23] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | -0.97 | [-1.07, -0.88] | 1 | Logs |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | links |
|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | |
| ✅ | file_to_blackhole_0ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_1000ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_100ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_500ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | lost_bytes | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | lost_bytes | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
9db055b to
3c35c38
Compare
alopezz
left a comment
There was a problem hiding this comment.
My comments here are not blocking.
tbavelier
left a comment
There was a problem hiding this comment.
Don't think cont-platform owns any file here but LGTM
Yeah not sure why GitHub considers you codeowner 😅 |
Pinned golang images are only available as non-alpine flavor from `registry.ddbuild.io` and we don't really care about the _build_ image being heavy or not - as long as the final stage is light.
…istry.ddbuild.io` Since we are often quite quick to update the go versions in our images, it is possible that we try to update the golang version used in the base image faster than Renovate can update the upstream on DataDog/images. In that case we don't want to be unable to build the fakeintake in CI, so we fallback to docker.io in that case.
The default on Ubuntu being glibc, but we need musl to run in an alpine environment
…y login to `docker.io` when not found
6eea278 to
4913116
Compare
What does this PR do?
Updates
test/fakeintake/Dockerfileto try registry.ddbuild.io as a source first instead of an upstream repo for basegolangandalpineimagesAlso update the
update-goinvoke task and corresponding CI job.Motivation
Avoiding rate limits and increasing CI reliability.
Describe how you validated your changes
golangbase image that does not exist inregistry.ddbuild.io(1.25.4to be precise)Additional Notes
golangimages are only available as non-alpine flavor fromregistry.ddbuild.ioand we don't really care about the build image being heavy or not - as long as the final stage is light. Therefore we switch to an ubuntu base for the build stagedocker.ioin that case.