Repository navigation
ci(docker): add compose env snapshot tool and checks - #21820
devashish2203 wants to merge 4 commits into
Conversation
Add .github/scripts/compose_env_snapshot.py, which renders every Docker Compose stack (each profile bare and with shell overrides, each Gradle quickstart task, smoke, the AI smoke leg, ZDU) with `docker compose config` and diffs two snapshots. Add :docker:printComposeSettings, which prints the env and compose arguments the compose plugin uses per quickstart config. verify-quickstart-compose now runs on docker/** and env/** changes, asserts the generated quickstart file has no env_file key, checks that every stack renders, and on PRs posts a base-versus-PR snapshot diff as a job summary (failing only with the "no env change" label). The quickstart pre-commit hook also runs on env/ changes. No behaviour change to any stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR SummaryOverview The new
Reviewed by Cursor Bugbot for commit c8fdb45. Bugbot is set up for automated code reviews on this repo. Configure here. |
Smart test selectionpytest smoke testsMode: active. Only the selection below runs for the pytest smoke tests on this PR (applied:
Selected scopes (3 files or classes, 10 tests)
Add the Playwright E2E testsThis run:
Add the commit |
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…labelled intended The snapshot diff job now fails on any difference in the rendered compose model unless the PR carries the env-change-intended label. With the label the job passes and still posts the diff as the job summary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- printComposeSettings redacts secret, signing key and salt values. - The snapshot diff exits 2 on a tool error, and the workflow always fails on it, label or not. - A known-broken stack only counts as known when it fails with its recorded error. - The shell scenario sets DATAHUB_APP_VERSION, a container env value. - The check also runs when docker-unified.yml or zdu-e2e-daily.yml change. - check_quickstart_compose.sh unsets variables named by any env file compose reads, including bare pass-through lines, and fails on a grep read error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
View guided diff | Turn on auto-fix | Re-trigger cubic
…aths - Move the render-failure check into unexpected_failures() and test that a known-broken stack failing with a different error counts as unexpected. - Run the check when the actions env file the AI scenario uses, or the Spark smoke env files the Gradle task points compose at, change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Adds a mechanical check of the resolved Docker Compose model, as groundwork for moving Docker env values into layered
env/files. No behaviour change to any stack..github/scripts/compose_env_snapshot.py(stdlib Python): renders each stack withdocker compose config --format jsonand keepsenvironment,image,ports,volumes,command,entrypointper service.snapshotwrites a file;diffcompares two. Checkout and home paths are normalised so two checkouts compare equal. Scenarios (98, about 5 s with a warm Gradle daemon):${KEY}from the compose and env files set to a sentinelquickstart_configsGradle key (covers ONNX and Spark)quickstart_compose()fromsmoke-test/run-quickstart.shdocker-unified.yml(both providers)docker-compose.zdu-test-override.yml, both topologies)snapshotexits 1 when a stack fails to render, unless it is a known-broken stack failing with its recorded error;diffexits 1 when the snapshots differ. Any tool error exits 2.:docker:printComposeSettings: prints, per quickstart config, the env and compose arguments the compose plugin uses (read fromcomposeExecutor, asgenerateQuickstartComposeConfigdoes). The plugin'senvironmentoverrides the process env; process-env keys the plugin does not set still reach compose. Values of keys ending inSECRET,SIGNING_KEYorSALTare printed as<redacted>.verify-quickstart-compose.yml:docker/**,env/**,smoke-test/run-quickstart.sh, the scripts, the workflows the tool copies the AI leg and ZDU settings from (docker-unified.yml,zdu-e2e-daily.yml), and the env files it points compose at (smoke-test/test_resources/actions/actions.env, the Spark smoke test's*.envfiles); it also re-runs when a label is added or removedenv_filekeyenv-change-intendedlabel; a tool error always fails it.check_quickstart_compose.shalso unsets variables named in the*.envfiles underdocker/andenv/, including bare pass-through lines; its pre-commit hook now also runs onenv/changes (override file and generated config).test-github-scripts.yml.Notes for reviewers
gradle/*stack, because the base branch has noprintComposeSettingstask yet. It therefore carries theenv-change-intendedlabel.debug-frontend:frontend-debug-frontenddepends onsystem-update-debug, which is not in that profilequickstartDebugSearchSplit: its compose filedocker/profiles/docker-compose.search-split-override.ymlis not in the repositoryVerification
python3 .github/scripts/compose_env_snapshot.py snapshot -o …: 98 scenarios, 3 render failures, all known-broken. Two runs diff empty.gradle/*(master lacks the print task).bash .github/scripts/check_quickstart_compose.sh: generated quickstart file unchanged.quickstartCLIwith conflicting shell values.pytest .github/scripts/test/test_compose_env_snapshot.py(diff output, and known-broken matching on the recorded error), ruff and mypy (settings oftest-github-scripts.yml), actionlint,githubActionsPrettierCheck: pass.Checklist
🤖 Generated with Claude Code
Summary by cubic
Adds a snapshot tool for the resolved Docker Compose model of every stack, groundwork for moving Docker env values into layered
env/files. No behavior change to any stack.compose_env_snapshot.pyrenders roughly 98 scenarios (profiles, Gradle quickstart tasks, smoke, AI leg, ZDU) and diffs two snapshots; checkout and home paths are normalized so two checkouts compare equal. A stack that fails with an unexpected (non-recorded) error fails the check.printComposeSettingsprints the env and compose arguments the compose plugin uses per quickstart config, redacting secrets.verify-quickstart-compose.ymlruns on PRs touchingdocker/**,env/**, the snapshot scripts, the workflows and env files the tool copies settings from; asserts the generated quickstart file has noenv_filekey, and posts a base-versus-PR snapshot diff as the job summary. The diff fails the job on any difference unless the PR carries theenv-change-intendedlabel; tool errors always fail.env/changes, and the checker unsets variables named by env files compose reads, including bare pass-through lines.Two stacks are known-broken: profile
debug-frontenddepends on a service not in its profile, and Gradle taskquickstartDebugSearchSplitreferences a compose file not in the repository.Written for commit c8fdb45. Summary will update on new commits.