summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-04-05 12:27:36 -0400
committerMatthew Heon <mheon@redhat.com>2021-04-16 13:07:46 -0400
commit5bca115dab272e1257db11dfb63858deb87ae34d (patch)
tree81e32feb9f3de76b3498b1933789e4b2dd8c9fa6
parent0cbd3225909d982a7dbd5fbc8c593dc1315abb8b (diff)
downloadpodman-5bca115dab272e1257db11dfb63858deb87ae34d.tar.gz
podman-5bca115dab272e1257db11dfb63858deb87ae34d.tar.bz2
podman-5bca115dab272e1257db11dfb63858deb87ae34d.zip
Verify existence of auth file if specified
Fixes: https://github.com/containers/podman/issues/9572 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> <MH: Fixed cherry-pick conflicts> Signed-off-by: Matthew Heon <mheon@redhat.com>
-rw-r--r--cmd/podman/images/build.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index da6d556b1..7bb05e9b1 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -11,6 +11,7 @@ import (
"github.com/containers/buildah/define"
buildahCLI "github.com/containers/buildah/pkg/cli"
"github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/auth"
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config"
encconfig "github.com/containers/ocicrypt/config"
@@ -330,6 +331,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
pullPolicy = define.PullNever
}
+ if c.Flag("authfile").Changed {
+ if err := auth.CheckAuthFile(flags.Authfile); err != nil {
+ return nil, err
+ }
+ }
+
args := make(map[string]string)
if c.Flag("build-arg").Changed {
for _, arg := range flags.BuildArg {