Skip to content

Commit

Permalink
nydusify: support --with-referrer option
Browse files Browse the repository at this point in the history
With this option, 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.

Prior to this PR, we had enabled this feature by default. However,
it is now known that Docker Hub does not yet support Referrer.

Therefore, adding this option to disable this feature by default,
to ensure broad compatibility with various image registries.

Fix dragonflyoss#1363.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
  • Loading branch information
imeoer committed Jul 31, 2023
1 parent 6066267 commit c040c7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contrib/nydusify/cmd/nydusify.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ func main() {
Usage: "Convert to OCI-referenced nydus zran image",
EnvVars: []string{"OCI_REF"},
},
&cli.BoolFlag{
Name: "with-referrer",
Value: false,
Usage: "Associate a reference to the source image, see https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers",
EnvVars: []string{"WITH_REFERRER"},
},
&cli.BoolFlag{
Name: "oci",
Value: false,
Expand Down Expand Up @@ -510,6 +516,7 @@ func main() {
BatchSize: c.String("batch-size"),

OCIRef: c.Bool("oci-ref"),
WithReferrer: c.Bool("with-referrer"),
AllPlatforms: c.Bool("all-platforms"),
Platforms: c.String("platform"),

Expand Down
1 change: 1 addition & 0 deletions contrib/nydusify/pkg/converter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func getConfig(opt Opt) map[string]string {
cfg["docker2oci"] = strconv.FormatBool(opt.Docker2OCI)
cfg["merge_manifest"] = strconv.FormatBool(opt.MergePlatform)
cfg["oci_ref"] = strconv.FormatBool(opt.OCIRef)
cfg["with_referrer"] = strconv.FormatBool(opt.WithReferrer)

cfg["prefetch_patterns"] = opt.PrefetchPatterns
cfg["compressor"] = opt.Compressor
Expand Down
1 change: 1 addition & 0 deletions contrib/nydusify/pkg/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Opt struct {
BatchSize string
PrefetchPatterns string
OCIRef bool
WithReferrer bool

AllPlatforms bool
Platforms string
Expand Down

0 comments on commit c040c7d

Please sign in to comment.