summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-03-02 15:28:50 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-03-07 06:42:02 -0500
commit01ffe2c30ae7bcd83e5556dfdf2d657e6a4539c2 (patch)
treed461a0babc8af6def0b013829151f5068b4b29cc
parent2c500a8145854c5f566bf76199d2a27226925b60 (diff)
downloadpodman-01ffe2c30ae7bcd83e5556dfdf2d657e6a4539c2.tar.gz
podman-01ffe2c30ae7bcd83e5556dfdf2d657e6a4539c2.tar.bz2
podman-01ffe2c30ae7bcd83e5556dfdf2d657e6a4539c2.zip
podman build --build-arg should fall back to environment
Fixes: https://github.com/containers/podman/issues/9571 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--cmd/podman/images/build.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 78cf4efd0..97eb966b7 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -318,7 +318,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
if len(av) > 1 {
args[av[0]] = av[1]
} else {
- delete(args, av[0])
+ // check if the env is set in the local environment and use that value if it is
+ if val, present := os.LookupEnv(av[0]); present {
+ args[av[0]] = val
+ } else {
+ delete(args, av[0])
+ }
}
}
}