update c/common to latest main

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-02-07 10:59:33 +01:00
parent cb1bac7331
commit ef8e63cb29
50 changed files with 336 additions and 155 deletions

View File

@@ -14,6 +14,7 @@ import (
multierror "github.com/hashicorp/go-multierror"
digest "github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
// supplementedImageReference groups multiple references together.
@@ -139,7 +140,7 @@ func (s *supplementedImageReference) NewImageSource(ctx context.Context, sys *ty
}
sources[manifestDigest] = src
// Parse the manifest as a list of images.
// Parse the manifest as a list of images and artifacts.
list, err := manifest.ListFromBlob(manifestBytes, manifestType)
if err != nil {
return fmt.Errorf("parsing manifest blob %q as a %q: %w", string(manifestBytes), manifestType, err)
@@ -155,7 +156,11 @@ func (s *supplementedImageReference) NewImageSource(ctx context.Context, sys *ty
}
chaseInstances = []digest.Digest{instance}
case cp.CopySpecificImages:
chaseInstances = s.instances
for _, instance := range list.Instances() {
if slices.Contains(s.instances, instance) {
chaseInstances = append(chaseInstances, instance)
}
}
case cp.CopyAllImages:
chaseInstances = list.Instances()
}