Merge pull request #8740 from djdongjin/platform-parseall

Add a platform.ParseAll helper
This commit is contained in:
Kazuyoshi Kato
2023-06-28 08:01:12 -07:00
committed by GitHub
7 changed files with 35 additions and 64 deletions

View File

@@ -37,13 +37,9 @@ func (ts *localTransferService) push(ctx context.Context, ig transfer.ImageGette
// TODO: Platform matching
if pushCtx.PlatformMatcher == nil {
if len(pushCtx.Platforms) > 0 {
var ps []ocispec.Platform
for _, platform := range pushCtx.Platforms {
p, err := platforms.Parse(platform)
if err != nil {
return fmt.Errorf("invalid platform %s: %w", platform, err)
}
ps = append(ps, p)
ps, err := platforms.ParseAll(pushCtx.Platforms)
if err != nil {
return err
}
pushCtx.PlatformMatcher = platforms.Any(ps...)
} else {