Skip validation when extracting config variables#13831
Conversation
Signed-off-by: bigmomma <scarab.systems@yahoo.com>
|
/review |
|
❌ PR Review Failed — The review agent encountered an error and could not complete the review. View logs. |
glours
left a comment
There was a problem hiding this comment.
The fix looks correct, but I’d like us to add a regression test covering the up path as well.
The issue originally affects the remote-stack prompt flow used by up, so having coverage there would help ensure this does not regress again.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks for the review. That makes sense, and I appreciate the context on the |
Signed-off-by: bigmomma <scarab.systems@yahoo.com>
|
Added the focused |
There was a problem hiding this comment.
Pull request overview
This PR fixes failures when discovering interpolation variables from Compose files that still contain ${...} expressions in typed fields (e.g., ports[].host_ip, ports[].published), particularly for remote stacks (OCI/Git) and docker compose config --variables. It does so by loading the Compose model with validation disabled for these variable-discovery paths.
Changes:
- Load unresolved models for variable discovery with
loader.WithSkipValidationto avoid typed-field validation errors while interpolation expressions are present. - Apply the same “skip validation” behavior to
config --variablesand remote-stack interpolation-variable prompting. - Add regression tests covering templated typed port fields (including a remote-loader override for test-only remote stack simulation).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/compose/options.go | Skips validation when loading a model for interpolation-variable extraction. |
| cmd/compose/config.go | Skips validation when loading a model for config --variables. |
| cmd/compose/compose.go | Adds a test hook to override remote loaders for deterministic remote-stack prompting tests. |
| cmd/compose/options_test.go | Adds regression tests ensuring templated typed port fields don’t break variable extraction / config --variables. |
| cmd/compose/up_test.go | Adds regression test ensuring remote-stack prompting works with templated typed port fields. |
What I did
config --variablesand remote-stack interpolation-variable prompting.host_ipandpublished.Related issue
Fixes #13613
(not mandatory) A picture of a cute animal, if possible in relation to what you did

![cute fuzzy animal]
Validation
go test ./cmd/composedocker buildx bake lint