-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore env replacement process of ARG's variable names #5156
base: master
Are you sure you want to change the base?
Restore env replacement process of ARG's variable names #5156
Conversation
Up to 1.7.1, variable names in ARG command could also use environment replacement, but in commit 47a52a1 remove the replacement process, so the replacement for variable names is no longer available in 1.8.0. This PR restore this. In addition, remove the Expand method of ArgCommand because it was no longer used. Signed-off-by: Mitsuru Kariya <[email protected]>
What's the example case? Seems to work fine for me in v0.15.0-rc2
If there is a regression then needs tests as well. |
Ah, I understand the report now. The replacement is in the key of
I had no idea this was supported. It doesn't look very useful as you need to have static keys for passing @thaJeztah @dvdksn Do you know if this is documented behavior? Or something that you think is being relied on? |
More weird cases (with v0.13)
|
Thanks for the quick response! Honestly, I have to confess that I originally didn't think this was supported either, but when I looked into it earlier, I noticed that it was available for I stumbled upon these behaviors while looking into environment replacement, and unfortunately, I couldn't find any documentation about it. Recently, I happened to notice that in version Therefore, if (In any case, I don't think we need |
I don't think this is a documented behavior. Personally I don't think interpolation for keys seems like a good idea. |
Yes, I don't think this is documented either, but admittedly we've not always been great at documenting some of the semantics in-depths (specifically in the early beginnings of Docker). Worse, in some cases PRs have been accepted that updated the docs to match the behavior, which in some cases led to documenting a bug as "intended", so we must always keep our eyes peeled to see if the behavior is the expected behavior 😅 I do recall that (at least with the classic builder), we had some cases in the past where code was shared between parsing of DOCKER_BUILDKIT=0 docker build -t foo -<<'EOF'
FROM alpine
ENV FOO=foo
ENV FOO$FOO=foofoo
LABEL FOO$FOO=foofoo
EOF
docker image inspect foo --format 'ENV: {{json .Config.Env}} LABEL: {{json .Config.Labels}}'
ENV: ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","FOO=foo","FOOfoo=foofoo"] LABEL: {"FOOfoo":"foofoo"} For this one;
|
Thank you @tonistiigi for linking my Bug report to this PR. |
Up to 1.7.1, variable names in
ARG
command could also use environment replacement, but in commit 47a52a1 remove the replacement process, so the replacement for variable names is no longer available in 1.8.0.This PR restore this.
In addition, remove the
Expand
method ofArgCommand
because it was no longer used.