(manifests []types.ImageManifest, targetRef reference.Named)
| 122 | } |
| 123 | |
| 124 | func buildManifestList(manifests []types.ImageManifest, targetRef reference.Named) (*manifestlist.DeserializedManifestList, error) { |
| 125 | targetRepo := reference.TrimNamed(targetRef) |
| 126 | descriptors := make([]manifestlist.ManifestDescriptor, 0, len(manifests)) |
| 127 | for _, imageManifest := range manifests { |
| 128 | if imageManifest.Descriptor.Platform == nil || |
| 129 | imageManifest.Descriptor.Platform.Architecture == "" || |
| 130 | imageManifest.Descriptor.Platform.OS == "" { |
| 131 | return nil, fmt.Errorf("manifest %s must have an OS and Architecture to be pushed to a registry", imageManifest.Ref) |
| 132 | } |
| 133 | descriptor, err := buildManifestDescriptor(targetRepo, imageManifest) |
| 134 | if err != nil { |
| 135 | return nil, err |
| 136 | } |
| 137 | descriptors = append(descriptors, descriptor) |
| 138 | } |
| 139 | |
| 140 | return manifestlist.FromDescriptors(descriptors) |
| 141 | } |
| 142 | |
| 143 | func buildManifestDescriptor(targetRepo reference.Named, imageManifest types.ImageManifest) (manifestlist.ManifestDescriptor, error) { |
| 144 | manifestRepoHostname := reference.Domain(reference.TrimNamed(imageManifest.Ref)) |
no test coverage detected
searching dependent graphs…