refactor(docker): share env/common GMS values between Docker and Docker-free

DE
16h ago
+54-68

Stacked on #21829.

Docker GMS services now read env/common/gms.env, the file the Docker-free stack already reads, so both stacks share one copy of these values. Docker's own copies are deleted. The effective env of every service is unchanged on both stacks.

Keys now shared

Opt-in defaults (KEY=${KEY:-default}): ALTERNATE_MCP_VALIDATION, STRICT_URN_VALIDATION_ENABLED, ENTITY_VERSIONING_ENABLED, THEME_V2_DEFAULT, SHOW_HAS_SIBLINGS_FILTER, SHOW_SEARCH_BAR_AUTOCOMPLETE_REDESIGN, SEARCH_BAR_API_VARIANT, SHOW_HOME_PAGE_REDESIGN, DEV_TOOLING_ENABLED, VIEW_AUTHORIZATION_ENABLED, DATAHUB_BASE_PATH, DATAHUB_GMS_BASE_PATH, MCL_CONSUMER_BATCH_ENABLED, USAGE_AGGREGATION_ENABLED, USAGE_AGGREGATION_FLUSH_INTERVAL_SECONDS, USAGE_AGGREGATION_ALIGNMENT_PERIOD_SECONDS, USAGE_AGGREGATION_INCLUDE_AGENT_NAME.

Literals: ELASTICSEARCH_LIMIT_RESULTS_STRICT, GRAPH_SERVICE_DIFF_MODE_ENABLED, ENTITY_SERVICE_ENABLE_RETENTION, UI_INGESTION_ENABLED, CONFIG_ENTITY_REGISTRY_USE_OPTIMIZED_LOADING, GRAPHQL_SHAPE_LOGGING_* (5 keys), ZDU_STAGE_10, ZDU_STAGE_20.

They are removed from env/docker/gms.env and from the GMS environment: anchor (including four restated DEV_TOOLING_ENABLED lines). That anchor is used only by GMS services, so no other service loses a key. Cassandra's ZDU_STAGE_20=false comes from env/docker/variants/cassandra/gms.env, which is later in the list, so it still wins. Exception: Docker keeps DATAHUB_BASE_PATH and DATAHUB_GMS_BASE_PATH in environment: (x-datahub-common), which wins over the shared file and reads the same shell value.

Moved to env/docker-free

ES_BULK_ACK_AFTER_TRANSFER=true and POLICY_CACHE_REFRESH_INTERVAL_SECONDS=10 differ on Docker (unset, and 120). They move from env/common/gms.env to env/docker-free/gms.env, so env/common holds only values that are equal on both stacks.

Who reads env/common

  • Every Docker GMS service: env/common/all.env (optional; does not exist) then env/common/gms.env, first in each env_file list (base, debug, and the six variant lists).
  • Not Docker system-update: it keeps its env unchanged and does not read GMS files.
  • Not mae-consumer, mce-consumer, frontend, actions or ai-service: there is no env/common/<service>.env for them.
  • datahub-dev env list shows env/common first in layers.

The legacy docker/mysql/docker-compose.mysql.yml fragment now lists env/common/gms.env before env/docker/gms.env, so it keeps the values removed from the Docker file.

Verification

Each check below compares the base branch with this branch:

  • compose_env_snapshot.py (from #21820) scenarios bare, shell, smoke, ai, zdu: no differences (71 scenarios; debug-frontend is known-broken on the base too). The shell scenario sets each opt-in key in the shell, which shows the keys stay opt-in.
  • gradle scenarios (all 27 quickstart_configs keys), run on scratch copies with the print task's docker/build.gradle: no differences (quickstartDebugSearchSplit is known-broken on the base too).
  • gms-lite-stack.py --print-env for each job (none, smoke-test, playwright) and mode (local, ci): identical values, apart from INDEX_PREFIX, which comes from the checkout path. Only the source of the two moved keys changes.
  • python3 smoke-test/check_env_parity.py: exit 0, allowlist unchanged.
  • ./gradlew :scripts:dev:test: pass.
  • ./gradlew :docker:generateQuickstartComposeConfig then git diff --exit-code docker/quickstart/: clean.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (PR title format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable): _docker_layer_order unit test
  • Docs related to the changes have been added/updated (if applicable): env/README.md
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes: not a breaking change

🤖 Generated with Claude Code


Summary by cubic

Docker GMS services now read env/common/gms.env, the file the Docker-free stack already reads, so both stacks share one source of common GMS values and Docker's own copies are removed. The effective environment of every service is unchanged on both stacks.

The shared keys are opt-in defaults like ALTERNATE_MCP_VALIDATION and literals like ELASTICSEARCH_LIMIT_RESULTS_STRICT. The two keys that differ on Docker, ES_BULK_ACK_AFTER_TRANSFER and POLICY_CACHE_REFRESH_INTERVAL_SECONDS, move to env/docker-free/gms.env. Docker GMS services list env/common/all.env (optional) and env/common/gms.env first in each env_file list; system-update and the other services don't read env/common.

Verification

  • Compose env snapshots, gradle quickstart configs, gms-lite-stack.py --print-env, and check_env_parity.py all show effective env identical to the base branch.