MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / getManifestList

Function getManifestList

cli/internal/publish/plugins.go:531–562  ·  view source on GitHub ↗
(ctx context.Context, manifestService distribution.ManifestService, pkgJSON PackageJSONV1)

Source from the content-addressed store, hash-verified

529}
530
531func 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
564func pushManifest(ctx context.Context, pkgJSON PackageJSONV1, dockerToken string, insecureSkipVerify bool) error {
565 imageName, repository, err := getManifestParams(pkgJSON.SupportedTargets[0].DockerImageTag)

Callers 1

pushManifestFunction · 0.85

Calls 3

getTagsFromTargetsFunction · 0.85
ErrorfMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected