Skip to content

refactor(docker): add optional env layer slots to compose env_file lists - #21821

Open
devashish2203 wants to merge 5 commits into
pfp-8939-env-files-movefrom
pfp-8940-env-layer-slots
Open

devashish2203 wants to merge 5 commits into
pfp-8939-env-files-movefrom
pfp-8940-env-layer-slots

Conversation

@devashish2203

@devashish2203 devashish2203 commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  1. env/docker/all.env, the existing env/docker/<service>.env, then the same names in env/docker/${DATAHUB_ENV_MODE:-local}/
  2. Extension: ${DATAHUB_ENV_EXTENSION_DIR}/docker/{all,<service>}.env
  3. Job: ${DATAHUB_ENV_JOB_DIR}/{all,<service>}.env, then its ${DATAHUB_ENV_MODE}/ subfolder, then its docker/ subfolder
  4. 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 json for all 33 profiles (231 profile/service pairs), on the base and on this branch: identical. debug-frontend fails 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. The ci/ files are ignored when DATAHUB_ENV_MODE is unset.
  • ./gradlew :docker:generateQuickstartComposeConfig: no diff, and the file has no env_file key.
  • 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, the DATAHUB_ENV_MODE subfolder, 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 .unset folder, so every slot is a no-op by default and rendered config is unchanged for all profiles.
  • gms-dev reuses the gms list via a YAML anchor.
  • docker/profiles/ now requires Docker Compose 2.24.0 or later; the quickstart compose file has no env_file entries and is unaffected.
  • Layer order and variables are documented in env/README.md under "Docker stack".

Written for commit 2adb907. Summary will update on new commits.

View guided diff Turn on auto-fix

Every DataHub service env_file list in docker/profiles now names the
optional layer files, lowest precedence first: env/docker/all.env and the
service file, the env/docker/<mode>/ files, an extension slot
(DATAHUB_ENV_EXTENSION_DIR), and a job slot (DATAHUB_ENV_JOB_DIR, then its
mode and docker/ subfolders). The existing ad-hoc slots stay last.

All new entries are `required: false`. An unset directory variable
resolves to a folder that does not exist, so the rendered config is
unchanged until a variable is set or a layer file is added. The gms-dev
service reuses the gms list through a YAML anchor.

docker/profiles now needs Docker Compose 2.24.0 or later for optional
env_file entries. The flattened quickstart compose file has no env_file
entries and is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the devops PR or Issue related to DataHub backend & deployment label Dec 2, 2026
@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Adds optional, lowest-precedence-first env_file slots on every DataHub service in docker/profiles/ (GMS, gms-dev, system-update, MAE/MCE consumers, frontend, actions, AI). Each list now declares layered paths for env/docker/all.env, DATAHUB_ENV_MODE (local/ci), ${DATAHUB_ENV_EXTENSION_DIR}, and ${DATAHUB_ENV_JOB_DIR} (root, mode, and docker/ subfolders), all with required: false; unset directory vars resolve to a non-existent .unset path so behavior stays the same until files are provided. gms-dev shares the GMS list via a YAML anchor.

Requires Docker Compose 2.24.0+ for optional env_file entries (was 2.20): Gradle minDockerCompose2.24 gates ComposeUp tasks; developer docs, docker/README.md, breaking-changes.md, and env/README.md (“Docker stack”) document the order and the upgrade. datahub docker quickstart is unchanged (flattened compose has no env_file).

Reviewed by Cursor Bugbot for commit f69c187. Bugbot is set up for automated code reviews on this repo. Configure here.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docker/profiles/docker-compose.gms.yml Resolved
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Smart test selection

pytest smoke tests

Mode: active. Only the selection below runs for the pytest smoke tests on this PR (applied: canary).

  • Selection: canary: always-run modules plus this PR's changed tests (no product feature identified)
  • Size: 10 of 853 tests in 1 batch, predicted longest batch ~0 min
  • Tags: change-type: build, docs
  • Confidence: MEDIUM (10 changed files)
  • Classifier reasoning: The change raises the Docker Compose minimum to 2.24 in the Gradle check and adds optional env_file layers to the local compose profiles, which affect all services generically rather than a specific feature, plus docs updates.

Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches.

Selected scopes (3 files or classes, 10 tests)
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection

Add the run-all-tests:pytest label to run the full pytest suite on this PR.

Playwright E2E tests

This run: p0

  • Selection: p0: P0 tests plus the tests the change affects
  • Size: 145 tests in 79 spec files, ~32 min predicted on 4 shard(s)
  • Baseline: 79 spec files run for every PR (@p0)
  • No spec was selected because of this PR's changes.

Add the run-all-tests:playwright label to run the full Playwright suite on this PR.

commit 2adb907 · workflow run

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

devashish2203 and others added 2 commits December 3, 2026 15:02
Optional env_file entries in the profile compose files need Compose
2.24.0 or later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The profile compose files use optional env_file entries, which need
Compose 2.24.0. Rename the check to minDockerCompose2.24, update the
developer prerequisites and add a breaking-changes entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@david-leifker david-leifker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch was successfully deployed

1 active deployment
Preview — 2adb9072 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops PR or Issue related to DataHub backend & deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants