Skip to content

Commit

Permalink
Not prefer use local image create/add manifest
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
QiWang19 committed Nov 25, 2020
1 parent dd26b13 commit b3a1c89
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/buildah/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit b3a1c89

Please sign in to comment.