diff options
author | Aditya Rajan <flouthoc.git@gmail.com> | 2021-09-15 14:58:44 +0530 |
---|---|---|
committer | Aditya Rajan <flouthoc.git@gmail.com> | 2021-09-15 14:58:48 +0530 |
commit | d0c605cd3da07175478b5c3947056856558be9f7 (patch) | |
tree | 8428f3f4211c5e8f9c3f0fab838d3f507eed04f3 /cmd | |
parent | 222b62e7b0b8b8e5ac69b776d7024c63d620b29b (diff) | |
download | podman-d0c605cd3da07175478b5c3947056856558be9f7.tar.gz podman-d0c605cd3da07175478b5c3947056856558be9f7.tar.bz2 podman-d0c605cd3da07175478b5c3947056856558be9f7.zip |
build: mirror --authfile to filesystem if pointing to FD instead of file
Following commit makes sure that podman mirrors --authfile to a temporary
file in filesystem if arg is pointing to an FD instead of actual file
as FD can be only consumed once.
Reference:
* https://github.com/containers/buildah/pull/3498
* https://github.com/containers/buildah/issues/3070
[NO TESTS NEEDED]
Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/images/build.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index a1a28b809..985cdf920 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -11,6 +11,7 @@ import ( buildahDefine "github.com/containers/buildah/define" buildahCLI "github.com/containers/buildah/pkg/cli" "github.com/containers/buildah/pkg/parse" + buildahUtil "github.com/containers/buildah/pkg/util" "github.com/containers/common/pkg/auth" "github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/config" @@ -359,6 +360,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil } } + cleanTmpFile := false + flags.Authfile, cleanTmpFile = buildahUtil.MirrorToTempFileIfPathIsDescriptor(flags.Authfile) + if cleanTmpFile { + defer os.Remove(flags.Authfile) + } + args := make(map[string]string) if c.Flag("build-arg").Changed { for _, arg := range flags.BuildArg { |