From b3a1c89f503ec375c11ecacfeea3decf078dbf08 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Wed, 25 Nov 2020 15:21:04 -0500 Subject: [PATCH] Not prefer use local image create/add manifest Avoid first checking the image from local storage for `manifest create` and `manifest add` since the local image does not include other entries of the list from the registry. `--all` flag of `manifest create` and `manifest add` can not add all of the lists as expected. So first attempt to get manifest from the registry and if not successful, fall back to use local images. Signed-off-by: Qi Wang --- cmd/buildah/manifest.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cmd/buildah/manifest.go b/cmd/buildah/manifest.go index f8646c8fdf6..66c702c97f5 100644 --- a/cmd/buildah/manifest.go +++ b/cmd/buildah/manifest.go @@ -237,10 +237,13 @@ func manifestCreateCmd(c *cobra.Command, args []string, opts manifestCreateOpts) } for _, imageSpec := range imageSpecs { - ref, _, err := util.FindImage(store, "", systemContext, imageSpec) + ref, err := alltransports.ParseImageName(imageSpec) if err != nil { - if ref, err = alltransports.ParseImageName(imageSpec); err != nil { - return err + if ref, err = alltransports.ParseImageName(util.DefaultTransport + imageSpec); err != nil { + // check if the local image exists + if ref, _, err = util.FindImage(store, "", systemContext, imageSpec); err != nil { + return err + } } } if _, err = list.Add(getContext(), systemContext, ref, opts.all); err != nil { @@ -293,10 +296,13 @@ func manifestAddCmd(c *cobra.Command, args []string, opts manifestAddOpts) error return err } - ref, _, err := util.FindImage(store, "", systemContext, imageSpec) + ref, err := alltransports.ParseImageName(imageSpec) if err != nil { - if ref, err = alltransports.ParseImageName(imageSpec); err != nil { - return err + if ref, err = alltransports.ParseImageName(util.DefaultTransport + imageSpec); err != nil { + // check if the local image exists + if ref, _, err = util.FindImage(store, "", systemContext, imageSpec); err != nil { + return err + } } }