Skip to content

ci(ci): Build the CI image automatically from a hash of its inputs - #5336

Closed
thomas-lebeau wants to merge 1 commit into
mainfrom
thomas.lebeau/ci-image-auto-build
Closed

thomas-lebeau wants to merge 1 commit into
mainfrom
thomas.lebeau/ci-image-auto-build

Conversation

@thomas-lebeau

@thomas-lebeau thomas-lebeau commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

A Node.js, Playwright or Chrome update changes the CI image. Today, someone must:

  1. Increment CURRENT_CI_IMAGE in .gitlab-ci.yml (and stack the PRs when there are several image updates).
  2. Play the manual ci-image job.

These steps are manual, and the human commit prevents the PR auto-approver from approving these updates.

Refs: SCMGMT-1036

Changes

  1. The new file .gitlab/ci-image.yml defines the ci-image job. The job runs in the first stage of every pipeline. It:
    • calculates the image tag: a hash of the Dockerfile, .gitlab/ci-image.yml, CHROME_PACKAGE_VERSION and the root @playwright/test version.
    • builds and signs the image only if no image has this tag yet.
    • gives CI_IMAGE to the other jobs through a dotenv report.
  2. CURRENT_CI_IMAGE and the global CI_IMAGE are removed. The jobs keep image: $CI_IMAGE. GitLab expands image: on the runner, where the dotenv variables are available.
  3. A job with needs: only gets the dotenv variables of the jobs in its needs:, so unit-bs now needs ci-image.
  4. The deploy child pipelines include the same file. Their ci-image job calculates the tag again (the image exists), and every job with needs: also needs ci-image.
  5. The scheduled Chrome bump only changes CHROME_PACKAGE_VERSION.
  6. The handling-dependency-prs skill no longer stacks image PRs or asks to play ci-image.

To rebuild the image without changing its inputs (for example to get a newer commit-headless), change a comment in the Dockerfile.

Not sure about:

  • A PR pipeline cannot run the deploy child pipelines. Monitor the first release pipeline after the merge.
  • Every pipeline now has a ci-image job (about 30 seconds when the image exists) before the other jobs.

Follow-ups:

  • The dd-source auto-approver rule for Chrome bumps (ddoghq/dd-source#194581) expects CURRENT_CI_IMAGE +1. It must accept a change of CHROME_PACKAGE_VERSION only.
  • The Renovate auto-approver rule can then also approve the Node.js and Playwright updates.

Test instructions

In this PR's pipeline:

  1. ci-image builds the image registry.ddbuild.io/ci/browser-sdk:<hash>.
  2. The other jobs start in this image (job log: "Using docker image ...").
  3. Retry ci-image: it skips the build.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

The CI image tag was a hand-bumped CURRENT_CI_IMAGE integer, and someone had to
play the manual ci-image job. The ci-image job now runs first in every
pipeline: it computes the tag from a hash of the Dockerfile, .gitlab/ci-image.yml,
CHROME_PACKAGE_VERSION and the Playwright version, builds the image only when
the tag is missing, and gives CI_IMAGE to the other jobs through a dotenv report.
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum Salesforce 194.46 KiB 194.46 KiB 0 B 0.00% ✅
Rum 194.44 KiB 194.44 KiB 0 B 0.00% ✅
Rum Salesforce Profiler 8.10 KiB 8.10 KiB 0 B 0.00% ✅
Rum Profiler 8.10 KiB 8.10 KiB 0 B 0.00% ✅
Rum Salesforce Recorder 32.80 KiB 32.80 KiB 0 B 0.00% ✅
Rum Recorder 32.80 KiB 32.80 KiB 0 B 0.00% ✅
Logs 60.21 KiB 60.21 KiB 0 B 0.00% ✅
Rum Slim 149.83 KiB 149.83 KiB 0 B 0.00% ✅
Worker 24.23 KiB 24.23 KiB 0 B 0.00% ✅
Rum Shopify 225.98 KiB 225.98 KiB 0 B 0.00% ✅
Rum Shopify Profiler 8.10 KiB 8.10 KiB 0 B 0.00% ✅
Rum Shopify Recorder 4.85 KiB 4.85 KiB 0 B 0.00% ✅
Early Collection 309 B 309 B 0 B 0.00% ✅

@datadog-official

datadog-official Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 78.07% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 57f64d2 | Docs | View more details | Give us feedback!

Copy link
Copy Markdown
Collaborator Author

Closing: too complicated for the gain.

@github-actions github-actions Bot locked and limited conversation to collaborators Nov 26, 2026
@thomas-lebeau
thomas-lebeau deleted the thomas.lebeau/ci-image-auto-build branch November 26, 2026 16:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant