Propagate docker_run env vars to discovery-stability check's compose command#24533
Open
vitkyrka wants to merge 5 commits into
Open
Propagate docker_run env vars to discovery-stability check's compose command#24533vitkyrka wants to merge 5 commits into
vitkyrka wants to merge 5 commits into
Conversation
vitkyrka
added a commit
that referenced
this pull request
Jul 13, 2026
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: f4762a7 | Docs | Datadog PR Page | Give us feedback! |
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
3 tasks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fd521c3de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
vitkyrka
added a commit
that referenced
this pull request
Jul 14, 2026
f3908fc to
3251f62
Compare
3 tasks
During `ddev env test`, the `dd_environment` fixture that calls `docker_run` never runs (it's replaced with a no-op since the environment was already started by a separate `ddev env start` process). Any env vars docker_run's caller passed for compose-file interpolation were therefore missing when assert_all_discovery_candidates_stable shelled out to `docker compose ps`, causing compose to reject the file if a referenced variable had no fallback. docker_run now persists its env_vars alongside the other compose metadata it already saves across process boundaries, and _get_compose_container_id passes them through to the `docker compose ps` subprocess.
…y_candidates_stable temporal, pulsar, and ray each added a `:-<default>` fallback to a compose-file variable so `docker compose ps`/`logs` wouldn't fail during e2e discovery-stability tests. That was a workaround for docker_run not propagating its env vars across the separate `ddev env start`/`ddev env test` processes, now fixed centrally in docker.py.
…ars param
CI failed on temporal, pulsar, and ray with the same compose-parsing
error the previous commit fixed for the caller-supplied `env_vars`
param: `docker compose ps` still rejected the file over TEMPORAL_LOG_FOLDER,
DD_LOG_1, and RAY_LOG_FOLDER. Those integrations set those vars via
`shared_logs()`/a custom wrapper passed through `wrappers=`, not through
docker_run's own `env_vars=` param, so the previous fix's plain
`env_vars or {}` never saw them.
Instead of tracking one specific parameter, snapshot os.environ before
any wrapper runs and diff against it once every wrapper (docker_run's own
env_vars, mount_logs's shared_logs, and any caller-supplied wrappers) has
been entered. That captures whatever env vars any of them introduced,
regardless of which mechanism they used to set them.
3251f62 to
f4762a7
Compare
Contributor
Validation ReportAll 21 validations passed. Show details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Makes the env vars used to interpolate a
docker_runcompose file (whether passed viaenv_vars=, set byshared_logs(), or set by any other wrapper) available to thedocker compose ps/logscommands thatassert_all_discovery_candidates_stableshells out to, even when that call happens in a separateddev env testprocess from the one that started the environment. Also removes the per-integrationdocker-compose.yamlfallback defaults (temporal, pulsar, ray) that were added last week as workarounds for this same issue.Motivation
https://datadoghq.atlassian.net/browse/DSCVR-614
During
ddev env test, thedd_environmentfixture that callsdocker_runis replaced with a no-op, since the environment was already started by a separateddev env startprocess. Any env vars used to interpolate the compose file were therefore missing fromos.environin that later process. Whenassert_all_discovery_candidates_stableshelled out todocker compose ps/logsto inspect the running container, compose would reject the file with errors likeinvalid spec: empty section between colonsfor any referenced variable with no value and no fallback default.Rather than have every integration that adopts
assert_all_discovery_candidates_stableadd:-<default>fallbacks to its compose file,docker_runnow snapshots the env vars introduced by any of its wrappers and persists them alongside the compose metadata it already saves across process boundaries (compose file, service name, project name)._get_compose_container_idthen passes those env vars through explicitly to the subprocess it invokes.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged