Skip to content

Skip validation when extracting config variables#13831

Merged
glours merged 2 commits into
docker:mainfrom
scarab-systems:13613-config-variable-validation
Jun 12, 2026
Merged

Skip validation when extracting config variables#13831
glours merged 2 commits into
docker:mainfrom
scarab-systems:13613-config-variable-validation

Conversation

@scarab-systems

@scarab-systems scarab-systems commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What I did

  • Allow unresolved Compose models used for variable discovery to skip validation while interpolation expressions are still present.
  • Apply the same behavior to config --variables and remote-stack interpolation-variable prompting.
  • Add regression coverage for templated typed port fields such as host_ip and published.

Related issue

Fixes #13613

(not mandatory) A picture of a cute animal, if possible in relation to what you did
![cute fuzzy animal]
hortonhearsawho

Validation

  • go test ./cmd/compose
  • docker buildx bake lint

Signed-off-by: bigmomma <scarab.systems@yahoo.com>
@scarab-systems scarab-systems requested a review from a team as a code owner June 9, 2026 01:30
@scarab-systems scarab-systems requested review from glours and ndeloof June 9, 2026 01:30
@glours

glours commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

/review

@docker-agent

docker-agent Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR Review Failed — The review agent encountered an error and could not complete the review. View logs.

@glours glours 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.

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

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scarab-systems

scarab-systems commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. That makes sense, and I appreciate the context on the up remote-stack prompt flow. I’ll add a focused regression test for that path.

Signed-off-by: bigmomma <scarab.systems@yahoo.com>
@scarab-systems

Copy link
Copy Markdown
Contributor Author

Added the focused up regression test in the latest commit. I also verified it locally with go test ./cmd/compose -count=1 and make lint.

@scarab-systems scarab-systems requested a review from glours June 9, 2026 14:56
@scarab-systems

Copy link
Copy Markdown
Contributor Author

@glours The requested up remote-stack prompt regression coverage is now included in 8d9e5bc. I verified it with go test ./cmd/compose -count=1 and make lint.

Happy to adjust further if you want the coverage shaped differently.

@glours glours 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.

Thanks 🙏

Copilot AI 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.

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.WithSkipValidation to avoid typed-field validation errors while interpolation expressions are present.
  • Apply the same “skip validation” behavior to config --variables and 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.

@glours glours enabled auto-merge (rebase) June 12, 2026 13:24
@glours glours merged commit 6ded314 into docker:main Jun 12, 2026
39 checks passed
@scarab-systems scarab-systems deleted the 13613-config-variable-validation branch June 12, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] cannot customize oci:// app compose.yaml as variable interpolation fails

3 participants