Skip to content

Commit 4876289

Browse files
imeoerjiangliu
authored andcommitted
nydusify: support --with-referrer option
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 #1363. Signed-off-by: Yan Song <[email protected]>
1 parent 69e6874 commit 4876289

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

contrib/nydusify/cmd/nydusify.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ func main() {
338338
Usage: "Convert to OCI-referenced nydus zran image",
339339
EnvVars: []string{"OCI_REF"},
340340
},
341+
&cli.BoolFlag{
342+
Name: "with-referrer",
343+
Value: false,
344+
Usage: "Associate a reference to the source image, see https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers",
345+
EnvVars: []string{"WITH_REFERRER"},
346+
},
341347
&cli.BoolFlag{
342348
Name: "oci",
343349
Value: false,
@@ -510,6 +516,7 @@ func main() {
510516
BatchSize: c.String("batch-size"),
511517

512518
OCIRef: c.Bool("oci-ref"),
519+
WithReferrer: c.Bool("with-referrer"),
513520
AllPlatforms: c.Bool("all-platforms"),
514521
Platforms: c.String("platform"),
515522

contrib/nydusify/pkg/converter/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func getConfig(opt Opt) map[string]string {
2222
cfg["docker2oci"] = strconv.FormatBool(opt.Docker2OCI)
2323
cfg["merge_manifest"] = strconv.FormatBool(opt.MergePlatform)
2424
cfg["oci_ref"] = strconv.FormatBool(opt.OCIRef)
25+
cfg["with_referrer"] = strconv.FormatBool(opt.WithReferrer)
2526

2627
cfg["prefetch_patterns"] = opt.PrefetchPatterns
2728
cfg["compressor"] = opt.Compressor

contrib/nydusify/pkg/converter/converter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type Opt struct {
4545
BatchSize string
4646
PrefetchPatterns string
4747
OCIRef bool
48+
WithReferrer bool
4849

4950
AllPlatforms bool
5051
Platforms string

0 commit comments

Comments
 (0)