refactor(docker): add optional env layer slots to compose env_file lists
Stacked on #21819 (moves the service env files to env/docker/). Review that PR first.
What
Every DataHub service env_file list in docker/profiles/ (system-update, gms and gms-dev, mae-consumer, mce-consumer, frontend, actions, ai-service) now names the optional layer files. Order, lowest precedence first:
env/docker/all.env, the existingenv/docker/<service>.env, then the same names inenv/docker/${DATAHUB_ENV_MODE:-local}/- Extension:
${DATAHUB_ENV_EXTENSION_DIR}/docker/{all,<service>}.env - Job:
${DATAHUB_ENV_JOB_DIR}/{all,<service>}.env, then its${DATAHUB_ENV_MODE}/subfolder, then itsdocker/subfolder - The existing ad-hoc slots (
DATAHUB_LOCAL_COMMON_ENV,DATAHUB_LOCAL_<SERVICE>_ENV) stay last
All new entries are required: false, and no layer files are added. An unset directory variable resolves to docker/profiles/.unset/…, which does not exist, so Compose skips the entry with no warning. Every slot does nothing by default, and the rendered config of every profile is unchanged. The gms-dev service reuses the gms list through a YAML anchor. The order and the variables are documented in env/README.md under "Docker stack".
Compose version
Optional env_file entries need Docker Compose 2.24.0 or later (Compose docs). docker/README.md now states this for docker/profiles/, and the prerequisites in docs/developers.md now list Docker Compose >=2.24. The flattened docker/quickstart/docker-compose.quickstart-profile.yml used by datahub docker quickstart has no env_file entries, so the CLI quickstart and its Compose compatibility matrix are unaffected.
The minimum Docker Compose version for the profiles is now 2.24.0 (was 2.20), enforced by the Gradle check :docker:minDockerCompose2.24. A breaking-changes entry is added.
Verification
docker compose config --format jsonfor all 33 profiles (231 profile/service pairs), on the base and on this branch: identical.debug-frontendfails to render on both, as before.- Each slot was checked with scratch job and extension folders and
DATAHUB_ENV_MODE=ci. Removing the highest file one at a time, the value from each next file in the order above won. An ad-hoc file beats the job layer. Theci/files are ignored whenDATAHUB_ENV_MODEis unset. ./gradlew :docker:generateQuickstartComposeConfig: no diff, and the file has noenv_filekey.python3 smoke-test/check_env_parity.py: passes.
Checklist
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Links to related issues (if applicable)
- Tests for the changes have been added/updated (if applicable): no runtime change; verified by rendered-config comparison
- Docs related to the changes have been added/updated (if applicable)
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes
🤖 Generated with Claude Code
Summary by cubic
Adds optional environment layer slots to every service env_file list in docker/profiles/, ordered lowest-precedence-first, so layer files can override defaults without changing the rendered config until used.
- Each list now includes
env/docker/all.env, the service file, theDATAHUB_ENV_MODEsubfolder, a${DATAHUB_ENV_EXTENSION_DIR}slot, and${DATAHUB_ENV_JOB_DIR}slots (root, mode subfolder,docker/subfolder), with the existing ad-hoc slots staying last. - All new entries are
required: false; unset directory variables resolve to a non-existent.unsetfolder, so every slot is a no-op by default and rendered config is unchanged for all profiles. gms-devreuses the gms list via a YAML anchor.docker/profiles/now requires Docker Compose 2.24.0 or later; the quickstart compose file has noenv_fileentries and is unaffected.- Layer order and variables are documented in
env/README.mdunder "Docker stack".