diff options
author | Aditya Rajan <flouthoc.git@gmail.com> | 2021-09-15 14:58:44 +0530 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-09-16 11:00:05 -0400 |
commit | c407813d67cd51a1feead5aeb5c3a36f357ed36f (patch) | |
tree | 957c919288381a79ef1c05fab1385d43c4ca5fc9 /cmd/podman/images/build.go | |
parent | 69e327378f16a6abccc74191b44d22eee8032abb (diff) | |
download | podman-c407813d67cd51a1feead5aeb5c3a36f357ed36f.tar.gz podman-c407813d67cd51a1feead5aeb5c3a36f357ed36f.tar.bz2 podman-c407813d67cd51a1feead5aeb5c3a36f357ed36f.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/podman/images/build.go')
-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 { |