feat: support mount and secret injection for provider extensions (fix… - #14230
Aniket1260 wants to merge 2 commits into
Conversation
docker#14163) Signed-off-by: aniket1260 <anket1260@gmail.com>
glours
left a comment
There was a problem hiding this comment.
Thanks for picking up #14163, the underlying need is real.
Did you actually run TestProviderMountsAndSecrets before opening this? I did, against a real Docker daemon, and it fails:
test-1 | ls: /provider-data: No such file or directory
test-1 | ls: /run/secrets: No such file or directory
docker inspect on the created container confirms it: Mounts is empty. Neither the mount nor the secret ever reaches the dependent service — not in the string form, not in the struct form, regardless of whether Message is set.
Root cause: runPlugin merges provider output into the dependent service by appending to ServiceConfig.Volumes/Secrets and reassigning project.Services[name]. But by the time a provider actually runs, the executor has already captured a copy of that service into the execution plan (serviceCopy in reconcile.go) — before runPlugin ever executes. Environment is a map, so the earlier setenv/rawsetenv writes stay visible through that captured copy; Volumes/Secrets are slices, so appending to them after the fact only mutates a copy nothing downstream ever reads again. The feature this PR adds cannot work as wired, for either injection form.
That's the part that concerns me more than the bug itself: the description says the E2E test is there "to ensure the parsed volumes and secrets are seamlessly passed to dependent services," and that both representations are "handled." Neither claim holds up against just running the test that's supposed to prove it. That's a pretty clear sign this wasn't actually reviewed before submission, disclosure file or not.
One more thing worth fixing regardless: project.Secrets[secret.Source] = projSecret overwrites any secret the user already declared under that name with no warning — the rawsetenv path right above it does warn on an environment variable override, this should do the same.
Happy to look again once the plan/execution ordering issue is actually fixed and the E2E test is green against a real run, not just present in the diff.
|
@glours Thanks for your valuable time, and reviewing this PR. Before submitting my next commit. I'll definitely run it through docker daemon properly. I guess while verifying the issue I've not verified it in the right environment. I'll look into it properly and then submit the changes accordingly. Again thanks for the comment. |
|
I agree there's a need to extends provider support to address #14163, but I need to think twice on how this must be implemented in Compose. Please give me some time to review |
|
@ndeloof Sure Nicolas, Would love to hear some Ideation over the implementation |
Signed-off-by: aniket1260 <anket1260@gmail.com>
|
@glours I have updated the execution plan logic and verified the fix against a live Docker daemon. What I changed:
How things are behaving for me now:
For your refrence I am also attaching the required Screenshots
|





What I did
Added support for Compose provider extensions to inject
mountsandsecretsinto the Compose in-memory model, moving beyond just environment variable (setenv/rawsetenv) support. This helps prevent leaking sensitive credentials in configuration environments.JsonMessageandexecutePlugininpkg/compose/plugins.goto parsemountandsecretcommands from a provider plugin.TestExecutePlugin_MountsAndSecretsinpkg/compose/plugins_control_test.goto verify the JSON parsing behavior locally.docs/examples/provider.goto demonstrate the new capabilities by accepting--mountand--secretflags.TestProviderMountsAndSecretsinpkg/e2e/providers_test.goto ensure the parsed volumes and secrets are seamlessly passed to dependent services.AI_AGENT_DISCLOSURE.mdas part of the commit.Related issue
fixes #14163
(not mandatory) A picture of a cute animal, if possible in relation to what you did
