refactor(smoke): select the ZDU env through a job folder

DE
15h ago
+214-253

Stacked on #21832.

What changes

docker/profiles/zdu-test.env becomes the job folder smoke-test/env/zdu/ (one file, all.env, same five keys and values). It has to be all.env, because the old file reached every DataHub service through the ad-hoc DATAHUB_LOCAL_COMMON_ENV slot.

The folder sits with the other smoke job layers under smoke-test/env/. Neither smoke layer reads it: the launcher and the compose job slot read only a job folder's own files and its local/, ci/ and docker/ subfolders, check_env_parity.py reads smoke-test/env/ and smoke-test/env/ci/, and the GMS-lite workflow's smoke-test/env/** path filter excludes smoke-test/env/zdu/**. It is not under smoke-test/tests/, because a folder there without __init__.py fails .github/scripts/check_python_package.py.

  • ZDUTestRunner sets DATAHUB_ENV_JOB_DIR to the absolute folder before its first compose call. Both entry points (python -m tests.zdu.framework and test_zdu_upgrade.py) build the runner, and every compose call inherits the process env. Any job dir already set in the shell is replaced, so ZDU never mixes in another job's values.
  • The METADATA_SERVICE_AUTH_ENABLED=false shell export is removed from _shared.py, rolling_restart.py and nuke_and_redeploy.py. Since #21832, only env/docker/gms.env reads it (${METADATA_SERVICE_AUTH_ENABLED:-true}), and the job all.env sets a literal false later in the same env_file list.
  • Nuke no longer carries DATAHUB_LOCAL_COMMON_ENV through. It only copied the process env value, so removing it changes nothing.
  • Cleanup adds DATAHUB_ENV_JOB_DIR="" (compose treats empty as unset) and keeps DATAHUB_LOCAL_COMMON_ENV=empty.env, so the dev stack goes back to its defaults. It skips the recreate only when GMS runs the original image tag and no longer has ZDU_TEST_FRAMEWORK_ENABLED, a key only the ZDU layer sets: every recreate during the run loads that layer, so the tag alone does not prove the default env.
  • Comments, READMEs, run_test.md, the PDL patch README and env/README.md are updated. A stale upgrade_blocking.py comment that said system-update has no env_file is fixed.

Per-phase compose env, before and after

Process env: before = DATAHUB_LOCAL_COMMON_ENV=zdu-test.env (from the workflow); after = DATAHUB_ENV_JOB_DIR=<repo>/smoke-test/env/zdu (set by the runner).

Phase callBeforeAfter
plain docker compose (ps, logs, health)nonenone
nuke and redeploy (up_stack)old pins + mounts + tokens + DATAHUB_LOCAL_COMMON_ENV + METADATA_SERVICE_AUTH_ENABLED=falseold pins + mounts + tokens
prepare old stack (recreate)version + tokensunchanged
rolling restart / shared recreateversion + tokens + mounts + METADATA_SERVICE_AUTH_ENABLED=falseversion + tokens + mounts
system-update one-shot runsupdate/version + mounts + tokens; -e flagsunchanged
cleanup (recreate)version + tokens + DATAHUB_LOCAL_COMMON_ENV=empty.envsame + DATAHUB_ENV_JOB_DIR=""

Preflight

Preflight no longer requires DATAHUB_LOCAL_COMMON_ENV, because the runner always supplies the auth bypass. If it is set to anything other than empty.env:

  • The file must exist under docker/profiles/. This catches a leftover zdu-test.env before compose fails with a missing-file error.
  • The file must not set AUTH_POLICIES_ENABLED, REST_API_AUTHORIZATION_ENABLED or METADATA_SERVICE_AUTH_ENABLED to anything but false, and must not list them as bare KEY lines (compose then unsets them). The ad-hoc slot layers over the job slot, so such a line would turn auth back on.

Workflow

.github/workflows/zdu-e2e-daily.yml: one line removed, DATAHUB_LOCAL_COMMON_ENV: zdu-test.env. If it stayed, compose would fail on the deleted file.

Verification

  • Hand-rendered each phase's real compose command and env, before and after, for the debug and debug-consumers topologies. The command is docker compose -f docker-compose.yml -f docker-compose.zdu-test-override.yml config, run once per phase env above, plus cleanup with the job dir unset. Every service's rendered model is identical in all 16 renders. A control run without the job dir does differ, so the check catches real changes.
  • ./gradlew :smoke-test:stackFreePytest: 550 passed.
  • ./gradlew :smoke-test:pythonLint: ruff check and ruff format pass. mypy reports two errors in tests/e2e/knowledge/test_okf_reimport.py, a file this PR does not touch.
  • python3 .github/scripts/check_python_package.py: passes.
  • Compose env snapshot (bare, shell, smoke, AI scenarios), before and after: no differences.
  • ./gradlew :docker:generateQuickstartComposeConfig and git diff --exit-code docker/quickstart/: clean.
  • actionlint on the workflow: clean.

No runtime proof

The daily ZDU workflow does not run on PRs, and no stack was started for this change. All of the evidence above comes from rendered compose models and unit tests. Before merging, run the ZDU daily workflow on this branch manually (workflow_dispatch).

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)
  • 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 (not needed: no effective value changes; only the ZDU test harness is affected)

šŸ¤– Generated with Claude Code


Summary by cubic

Selects the ZDU test environment through a compose job folder instead of ad-hoc env slots. The file docker/profiles/zdu-test.env moves to smoke-test/env/zdu/all.env, the runner sets DATAHUB_ENV_JOB_DIR to that folder for every compose call, and the daily workflow no longer passes DATAHUB_LOCAL_COMMON_ENV. Phases drop their METADATA_SERVICE_AUTH_ENABLED=false shell exports since the job file delivers the same value.

  • Preflight no longer requires DATAHUB_LOCAL_COMMON_ENV; if set, the file must exist under docker/profiles/ and must not set AUTH_POLICIES_ENABLED, REST_API_AUTHORIZATION_ENABLED, or METADATA_SERVICE_AUTH_ENABLED to anything but false — including bare keys, which compose unsets and thereby drops the job layer's false.
  • Cleanup detects the ZDU layer by its ZDU_TEST_FRAMEWORK_ENABLED marker instead of the image tag alone, so it resets the env even when a container recreated during the run already carries the original tag; it clears DATAHUB_ENV_JOB_DIR and keeps DATAHUB_LOCAL_COMMON_ENV=empty.env.
  • The job folder lives at smoke-test/env/zdu/, next to the other smoke job layers; neither smoke layer reads it, and the GMS-lite workflow's smoke-test/env/** path filter now excludes it.
  • Verification is limited to rendered compose models and unit tests; the ZDU daily workflow does not run on PRs, so run it manually before merging.