Skip to content

Commit

Permalink
Merge pull request #510 from imeoer/backport-v0.9
Browse files Browse the repository at this point in the history
converter: allow controlling referrer with option
  • Loading branch information
changweige authored Jul 18, 2023
2 parents 2c811d7 + a75b65b commit 8d9a9fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/converter/convert_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,12 @@ func convertManifest(ctx context.Context, cs content.Store, oldDesc ocispec.Desc
// Update the config gc label
manifestLabels[configGCLabelKey] = newConfigDesc.Digest.String()

// Associate a reference to the original OCI manifest.
// See the `subject` field description in
// https://github.com/opencontainers/image-spec/blob/main/manifest.md#image-manifest-property-descriptions
manifest.Subject = &oldDesc
if opt.WithReferrer {
// Associate a reference to the original OCI manifest.
// See the `subject` field description in
// https://github.com/opencontainers/image-spec/blob/main/manifest.md#image-manifest-property-descriptions
manifest.Subject = &oldDesc
}

// Update image manifest in content store.
newManifestDesc, err := writeJSON(ctx, cs, manifest, manifestDesc, manifestLabels)
Expand Down
10 changes: 10 additions & 0 deletions pkg/converter/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ type MergeOption struct {
OCI bool
// OCIRef enables converting OCI tar(.gz) blob to nydus referenced blob.
OCIRef bool
// WithReferrer associates a reference to the original OCI manifest.
// See the `subject` field description in
// https://github.com/opencontainers/image-spec/blob/main/manifest.md#image-manifest-property-descriptions
//
// With this association, we can track all nydus images associated with
// an OCI image. For example, in Harbor we can cascade to show nydus
// images linked to an OCI image, deleting the OCI image can also delete
// the corresponding nydus images. At runtime, nydus snapshotter can also
// automatically upgrade an OCI image run to nydus image.
WithReferrer bool
// Backend uploads blobs generated by nydus-image builder to a backend storage.
Backend Backend
// Timeout cancels execution once exceed the specified time.
Expand Down

0 comments on commit 8d9a9fb

Please sign in to comment.