(ctx context.Context, manifestService distribution.ManifestService, pkgJSON PackageJSONV1)
| 529 | } |
| 530 | |
| 531 | func getManifestList(ctx context.Context, manifestService distribution.ManifestService, pkgJSON PackageJSONV1) (*manifestlist.DeserializedManifestList, error) { |
| 532 | namedTags, err := getTagsFromTargets(pkgJSON.SupportedTargets) |
| 533 | if err != nil { |
| 534 | return nil, err |
| 535 | } |
| 536 | |
| 537 | descriptors := make([]manifestlist.ManifestDescriptor, 0) |
| 538 | for i, namedTag := range namedTags { |
| 539 | buildTarget := pkgJSON.SupportedTargets[i] |
| 540 | manifest, err := manifestService.Get(ctx, "", distribution.WithTag(namedTag.Tag()), distribution.WithManifestMediaTypes([]string{schema2.MediaTypeManifest})) |
| 541 | if err != nil { |
| 542 | return nil, fmt.Errorf("failed to create Docker manifest: %v", err) |
| 543 | } |
| 544 | mediaType, canonical, err := manifest.Payload() |
| 545 | if err != nil { |
| 546 | return nil, fmt.Errorf("failed to create Docker manifest: %v", err) |
| 547 | } |
| 548 | manifestDesc := manifestlist.ManifestDescriptor{ |
| 549 | Descriptor: distribution.Descriptor{ |
| 550 | Digest: digest.FromBytes(canonical), |
| 551 | Size: int64(len(canonical)), |
| 552 | MediaType: mediaType}, |
| 553 | Platform: manifestlist.PlatformSpec{OS: buildTarget.OS, Architecture: buildTarget.Arch}, |
| 554 | } |
| 555 | descriptors = append(descriptors, manifestDesc) |
| 556 | } |
| 557 | list, err := manifestlist.FromDescriptors(descriptors) |
| 558 | if err != nil { |
| 559 | return nil, fmt.Errorf("failed to create Docker manifest: %v", err) |
| 560 | } |
| 561 | return list, nil |
| 562 | } |
| 563 | |
| 564 | func pushManifest(ctx context.Context, pkgJSON PackageJSONV1, dockerToken string, insecureSkipVerify bool) error { |
| 565 | imageName, repository, err := getManifestParams(pkgJSON.SupportedTargets[0].DockerImageTag) |
no test coverage detected