diff --git a/content/oci/oci.go b/content/oci/oci.go index be4d0f70..dac299ec 100644 --- a/content/oci/oci.go +++ b/content/oci/oci.go @@ -14,7 +14,7 @@ limitations under the License. */ // Package oci provides access to an OCI content store. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc6/image-layout.md +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md package oci import ( @@ -43,7 +43,7 @@ import ( // Store implements `oras.Target`, and represents a content store // based on file system with the OCI-Image layout. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc6/image-layout.md +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md type Store struct { // AutoSaveIndex controls if the OCI store will automatically save the index // file when needed. @@ -221,7 +221,7 @@ func (s *Store) delete(ctx context.Context, target ocispec.Descriptor) ([]ocispe // Tag tags a descriptor with a reference string. // reference should be a valid tag (e.g. "latest"). -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc6/image-layout.md#indexjson-file +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md#indexjson-file func (s *Store) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error { s.sync.RLock() defer s.sync.RUnlock() diff --git a/content/oci/readonlyoci.go b/content/oci/readonlyoci.go index 66ca54c9..2f390bb3 100644 --- a/content/oci/readonlyoci.go +++ b/content/oci/readonlyoci.go @@ -36,7 +36,7 @@ import ( // ReadOnlyStore implements `oras.ReadonlyTarget`, and represents a read-only // content store based on file system with the OCI-Image layout. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/image-layout.md +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md type ReadOnlyStore struct { fsys fs.FS storage content.ReadOnlyStorage diff --git a/content/oci/readonlystorage.go b/content/oci/readonlystorage.go index 6e319a64..50106d1d 100644 --- a/content/oci/readonlystorage.go +++ b/content/oci/readonlystorage.go @@ -31,7 +31,7 @@ import ( // ReadOnlyStorage is a read-only CAS based on file system with the OCI-Image // layout. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/image-layout.md +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md type ReadOnlyStorage struct { fsys fs.FS } diff --git a/content/oci/storage.go b/content/oci/storage.go index efb9f3d8..0a3dec37 100644 --- a/content/oci/storage.go +++ b/content/oci/storage.go @@ -43,7 +43,7 @@ var bufPool = sync.Pool{ } // Storage is a CAS based on file system with the OCI-Image layout. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/image-layout.md +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/image-layout.md type Storage struct { *ReadOnlyStorage // root is the root directory of the OCI layout. diff --git a/example_pack_test.go b/example_pack_test.go index a1d301c5..aff41d9b 100644 --- a/example_pack_test.go +++ b/example_pack_test.go @@ -25,9 +25,9 @@ import ( "oras.land/oras-go/v2/content/memory" ) -// ExampleImageV11RC4 demonstrates packing an OCI Image Manifest as defined in -// image-spec v1.1.0-rc4. -func ExamplePackManifest_imageV11RC4() { +// ExampleImageV11 demonstrates packing an OCI Image Manifest as defined in +// image-spec v1.1.0. +func ExamplePackManifest_imageV11() { // 0. Create a storage store := memory.New() @@ -43,7 +43,7 @@ func ExamplePackManifest_imageV11RC4() { // 2. Pack a manifest artifactType := "application/vnd.example+type" - manifestDesc, err := oras.PackManifest(ctx, store, oras.PackManifestVersion1_1_RC4, artifactType, opts) + manifestDesc, err := oras.PackManifest(ctx, store, oras.PackManifestVersion1_1, artifactType, opts) if err != nil { panic(err) } diff --git a/example_test.go b/example_test.go index f5829641..2094275f 100644 --- a/example_test.go +++ b/example_test.go @@ -169,7 +169,7 @@ func Example_pushFilesToRemoteRepository() { opts := oras.PackManifestOptions{ Layers: fileDescriptors, } - manifestDescriptor, err := oras.PackManifest(ctx, fs, oras.PackManifestVersion1_1_RC4, artifactType, opts) + manifestDescriptor, err := oras.PackManifest(ctx, fs, oras.PackManifestVersion1_1, artifactType, opts) if err != nil { panic(err) } diff --git a/pack.go b/pack.go index 08e14e19..5aea387a 100644 --- a/pack.go +++ b/pack.go @@ -53,7 +53,7 @@ var ( ErrInvalidDateTimeFormat = errors.New("invalid date and time format") // ErrMissingArtifactType is returned by [PackManifest] when - // packManifestVersion is PackManifestVersion1_1_RC4 and artifactType is + // packManifestVersion is PackManifestVersion1_1 and artifactType is // empty and the config media type is set to // "application/vnd.oci.empty.v1+json". ErrMissingArtifactType = errors.New("missing artifact type") @@ -71,7 +71,15 @@ const ( // PackManifestVersion1_1_RC4 represents the OCI Image Manifest defined // in image-spec v1.1.0-rc4. // Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/manifest.md - PackManifestVersion1_1_RC4 PackManifestVersion = 2 + // + // Deprecated: This constant is deprecated and not recommended for future use. + // Use [PackManifestVersion1_1] instead. + PackManifestVersion1_1_RC4 PackManifestVersion = PackManifestVersion1_1 + + // PackManifestVersion1_1 represents the OCI Image Manifest defined in + // image-spec v1.1.0. + // Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/manifest.md + PackManifestVersion1_1 PackManifestVersion = 2 ) // PackManifestOptions contains optional parameters for [PackManifest]. @@ -98,16 +106,16 @@ type PackManifestOptions struct { // mediaTypeRegexp checks the format of media types. // References: -// - https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/schema/defs-descriptor.json#L7 +// - https://github.com/opencontainers/image-spec/blob/v1.1.0/schema/defs-descriptor.json#L7 // - https://datatracker.ietf.org/doc/html/rfc6838#section-4.2 var mediaTypeRegexp = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$`) // PackManifest generates an OCI Image Manifest based on the given parameters // and pushes the packed manifest to a content storage using pusher. The version // of the manifest to be packed is determined by packManifestVersion -// (Recommended value: PackManifestVersion1_1_RC4). +// (Recommended value: PackManifestVersion1_1). // -// - If packManifestVersion is [PackManifestVersion1_1_RC4]: +// - If packManifestVersion is [PackManifestVersion1_1]: // artifactType MUST NOT be empty unless opts.ConfigDescriptor is specified. // - If packManifestVersion is [PackManifestVersion1_0]: // if opts.ConfigDescriptor is nil, artifactType will be used as the @@ -122,8 +130,8 @@ func PackManifest(ctx context.Context, pusher content.Pusher, packManifestVersio switch packManifestVersion { case PackManifestVersion1_0: return packManifestV1_0(ctx, pusher, artifactType, opts) - case PackManifestVersion1_1_RC4: - return packManifestV1_1_RC4(ctx, pusher, artifactType, opts) + case PackManifestVersion1_1: + return packManifestV1_1(ctx, pusher, artifactType, opts) default: return ocispec.Descriptor{}, fmt.Errorf("PackManifestVersion(%v): %w", packManifestVersion, errdef.ErrUnsupported) } @@ -283,9 +291,9 @@ func packManifestV1_1_RC2(ctx context.Context, pusher content.Pusher, configMedi return pushManifest(ctx, pusher, manifest, manifest.MediaType, manifest.Config.MediaType, manifest.Annotations) } -// packManifestV1_1_RC4 packs an image manifest defined in image-spec v1.1.0-rc4. -// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc4/manifest.md#guidelines-for-artifact-usage -func packManifestV1_1_RC4(ctx context.Context, pusher content.Pusher, artifactType string, opts PackManifestOptions) (ocispec.Descriptor, error) { +// packManifestV1_1 packs an image manifest defined in image-spec v1.1.0. +// Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0/manifest.md#guidelines-for-artifact-usage +func packManifestV1_1(ctx context.Context, pusher content.Pusher, artifactType string, opts PackManifestOptions) (ocispec.Descriptor, error) { if artifactType == "" && (opts.ConfigDescriptor == nil || opts.ConfigDescriptor.MediaType == ocispec.MediaTypeEmptyJSON) { // artifactType MUST be set when config.mediaType is set to the empty value return ocispec.Descriptor{}, ErrMissingArtifactType diff --git a/pack_test.go b/pack_test.go index 0f8bc04b..3e4bb58b 100644 --- a/pack_test.go +++ b/pack_test.go @@ -801,13 +801,13 @@ func Test_PackManifest_ImageV1_0_InvalidDateTimeFormat(t *testing.T) { } } -func Test_PackManifest_ImageV1_1_RC4(t *testing.T) { +func Test_PackManifest_ImageV1_1(t *testing.T) { s := memory.New() // test PackManifest ctx := context.Background() artifactType := "application/vnd.test" - manifestDesc, err := PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, PackManifestOptions{}) + manifestDesc, err := PackManifest(ctx, s, PackManifestVersion1_1, artifactType, PackManifestOptions{}) if err != nil { t.Fatal("Oras.PackManifest() error =", err) } @@ -831,7 +831,7 @@ func Test_PackManifest_ImageV1_1_RC4(t *testing.T) { } } -func Test_PackManifest_ImageV1_1_RC4_WithOptions(t *testing.T) { +func Test_PackManifest_ImageV1_1_WithOptions(t *testing.T) { s := memory.New() // prepare test content @@ -863,7 +863,7 @@ func Test_PackManifest_ImageV1_1_RC4_WithOptions(t *testing.T) { ConfigAnnotations: configAnnotations, ManifestAnnotations: annotations, } - manifestDesc, err := PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, opts) + manifestDesc, err := PackManifest(ctx, s, PackManifestVersion1_1, artifactType, opts) if err != nil { t.Fatal("Oras.PackManifest() error =", err) } @@ -916,7 +916,7 @@ func Test_PackManifest_ImageV1_1_RC4_WithOptions(t *testing.T) { ConfigAnnotations: configAnnotations, ManifestAnnotations: annotations, } - manifestDesc, err = PackManifest(ctx, s, PackManifestVersion1_1_RC4, "", opts) + manifestDesc, err = PackManifest(ctx, s, PackManifestVersion1_1, "", opts) if err != nil { t.Fatal("Oras.PackManifest() error =", err) } @@ -967,7 +967,7 @@ func Test_PackManifest_ImageV1_1_RC4_WithOptions(t *testing.T) { ConfigAnnotations: configAnnotations, ManifestAnnotations: annotations, } - manifestDesc, err = PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, opts) + manifestDesc, err = PackManifest(ctx, s, PackManifestVersion1_1, artifactType, opts) if err != nil { t.Fatal("Oras.PackManifest() error =", err) } @@ -1015,12 +1015,12 @@ func Test_PackManifest_ImageV1_1_RC4_WithOptions(t *testing.T) { } } -func Test_PackManifest_ImageV1_1_RC4_NoArtifactType(t *testing.T) { +func Test_PackManifest_ImageV1_1_NoArtifactType(t *testing.T) { s := memory.New() ctx := context.Background() // test no artifact type and no config - _, err := PackManifest(ctx, s, PackManifestVersion1_1_RC4, "", PackManifestOptions{}) + _, err := PackManifest(ctx, s, PackManifestVersion1_1, "", PackManifestOptions{}) if wantErr := ErrMissingArtifactType; !errors.Is(err, wantErr) { t.Errorf("Oras.PackManifest() error = %v, wantErr = %v", err, wantErr) } @@ -1031,13 +1031,13 @@ func Test_PackManifest_ImageV1_1_RC4_NoArtifactType(t *testing.T) { MediaType: ocispec.DescriptorEmptyJSON.MediaType, }, } - _, err = PackManifest(ctx, s, PackManifestVersion1_1_RC4, "", opts) + _, err = PackManifest(ctx, s, PackManifestVersion1_1, "", opts) if wantErr := ErrMissingArtifactType; !errors.Is(err, wantErr) { t.Errorf("Oras.PackManifest() error = %v, wantErr = %v", err, wantErr) } } -func Test_PackManifest_ImageV1_1_RC4_InvalidMediaType(t *testing.T) { +func Test_PackManifest_ImageV1_1_InvalidMediaType(t *testing.T) { s := memory.New() ctx := context.Background() @@ -1048,7 +1048,7 @@ func Test_PackManifest_ImageV1_1_RC4_InvalidMediaType(t *testing.T) { opts := PackManifestOptions{ ConfigDescriptor: &configDesc, } - _, err := PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, opts) + _, err := PackManifest(ctx, s, PackManifestVersion1_1, artifactType, opts) if wantErr := errdef.ErrInvalidMediaType; !errors.Is(err, wantErr) { t.Errorf("Oras.PackManifest() error = %v, wantErr = %v", err, wantErr) } @@ -1059,13 +1059,13 @@ func Test_PackManifest_ImageV1_1_RC4_InvalidMediaType(t *testing.T) { opts = PackManifestOptions{ ConfigDescriptor: &configDesc, } - _, err = PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, opts) + _, err = PackManifest(ctx, s, PackManifestVersion1_1, artifactType, opts) if wantErr := errdef.ErrInvalidMediaType; !errors.Is(err, wantErr) { t.Errorf("Oras.PackManifest() error = %v, wantErr = %v", err, wantErr) } } -func Test_PackManifest_ImageV1_1_RC4_InvalidDateTimeFormat(t *testing.T) { +func Test_PackManifest_ImageV1_1_InvalidDateTimeFormat(t *testing.T) { s := memory.New() ctx := context.Background() @@ -1075,7 +1075,7 @@ func Test_PackManifest_ImageV1_1_RC4_InvalidDateTimeFormat(t *testing.T) { }, } artifactType := "application/vnd.test" - _, err := PackManifest(ctx, s, PackManifestVersion1_1_RC4, artifactType, opts) + _, err := PackManifest(ctx, s, PackManifestVersion1_1, artifactType, opts) if wantErr := ErrInvalidDateTimeFormat; !errors.Is(err, wantErr) { t.Errorf("Oras.PackManifest() error = %v, wantErr = %v", err, wantErr) } diff --git a/registry/reference.go b/registry/reference.go index a8ad16f2..8fde0d22 100644 --- a/registry/reference.go +++ b/registry/reference.go @@ -34,13 +34,13 @@ var ( // // References: // - https://github.com/distribution/distribution/blob/v2.7.1/reference/regexp.go#L53 - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pulling-manifests + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pulling-manifests repositoryRegexp = regexp.MustCompile(`^[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*(?:/[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*)*$`) // tagRegexp checks the tag name. // The docker and OCI spec have the same regular expression. // - // Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pulling-manifests + // Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pulling-manifests tagRegexp = regexp.MustCompile(`^[\w][\w.-]{0,127}$`) ) diff --git a/registry/remote/errcode/errors.go b/registry/remote/errcode/errors.go index 78c6557a..9f87d86d 100644 --- a/registry/remote/errcode/errors.go +++ b/registry/remote/errcode/errors.go @@ -24,7 +24,7 @@ import ( ) // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#error-codes +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#error-codes // - https://docs.docker.com/registry/spec/api/#errors-2 const ( ErrorCodeBlobUnknown = "BLOB_UNKNOWN" @@ -45,7 +45,7 @@ const ( // Error represents a response inner error returned by the remote // registry. // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#error-codes +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#error-codes // - https://docs.docker.com/registry/spec/api/#errors-2 type Error struct { Code string `json:"code"` @@ -73,7 +73,7 @@ func (e Error) Error() string { // Errors represents a list of response inner errors returned by the remote // server. // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#error-codes +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#error-codes // - https://docs.docker.com/registry/spec/api/#errors-2 type Errors []Error diff --git a/registry/remote/referrers.go b/registry/remote/referrers.go index 45c738a0..74668089 100644 --- a/registry/remote/referrers.go +++ b/registry/remote/referrers.go @@ -102,7 +102,7 @@ func (e *ReferrersError) IsReferrersIndexDelete() bool { // buildReferrersTag builds the referrers tag for the given manifest descriptor. // Format: - -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#unavailable-referrers-api +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#unavailable-referrers-api func buildReferrersTag(desc ocispec.Descriptor) string { alg := desc.Digest.Algorithm().String() encoded := desc.Digest.Encoded() diff --git a/registry/remote/registry.go b/registry/remote/registry.go index 9af3f3a4..1099b585 100644 --- a/registry/remote/registry.go +++ b/registry/remote/registry.go @@ -94,7 +94,7 @@ func (r *Registry) do(req *http.Request) (*http.Response, error) { // // References: // - https://docs.docker.com/registry/spec/api/#base -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#api +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#api func (r *Registry) Ping(ctx context.Context) error { url := buildRegistryBaseURL(r.PlainHTTP, r.Reference) req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) diff --git a/registry/remote/repository.go b/registry/remote/repository.go index def5f56b..ac4efcc5 100644 --- a/registry/remote/repository.go +++ b/registry/remote/repository.go @@ -53,7 +53,7 @@ const ( // // References: // - https://docs.docker.com/registry/spec/api/#digest-header - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pull + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pull headerDockerContentDigest = "Docker-Content-Digest" // headerOCIFiltersApplied is the "OCI-Filters-Applied" header. @@ -61,7 +61,7 @@ const ( // applied filters. // // Reference: - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers headerOCIFiltersApplied = "OCI-Filters-Applied" // headerOCISubject is the "OCI-Subject" header. @@ -74,7 +74,7 @@ const ( // referrers. // // References: -// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers // - Compatible spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc1/spec.md#listing-referrers const filterTypeArtifactType = "artifactType" @@ -118,7 +118,7 @@ type Repository struct { // ReferrerListPageSize specifies the page size when invoking the Referrers // API. // If zero, the page size is determined by the remote registry. - // Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers + // Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers ReferrerListPageSize int // MaxMetadataBytes specifies a limit on how many response bytes are allowed @@ -133,16 +133,16 @@ type Repository struct { // is successfully uploaded. // - If true, the old referrers index is kept. // By default, it is disabled (set to false). See also: - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#referrers-tag-schema - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pushing-manifests-with-subject - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#deleting-manifests + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#referrers-tag-schema + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pushing-manifests-with-subject + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#deleting-manifests SkipReferrersGC bool // HandleWarning handles the warning returned by the remote server. // Callers SHOULD deduplicate warnings from multiple associated responses. // // References: - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#warnings + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#warnings // - https://www.rfc-editor.org/rfc/rfc7234#section-5.5 HandleWarning func(warning Warning) @@ -212,9 +212,9 @@ func (r *Repository) clone() *Repository { // SetReferrersCapability returns ErrReferrersCapabilityAlreadySet if the // Referrers API capability has been already set. // - When the capability is set to true, the Referrers() function will always -// request the Referrers API. Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// request the Referrers API. Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers // - When the capability is set to false, the Referrers() function will always -// request the Referrers Tag. Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#referrers-tag-schema +// request the Referrers Tag. Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#referrers-tag-schema // - When the capability is not set, the Referrers() function will automatically // determine which API to use. func (r *Repository) SetReferrersCapability(capable bool) error { @@ -388,7 +388,7 @@ func (r *Repository) ParseReference(reference string) (registry.Reference, error // of the Tags list. // // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#content-discovery +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#content-discovery // - https://docs.docker.com/registry/spec/api/#tags func (r *Repository) Tags(ctx context.Context, last string, fn func(tags []string) error) error { ctx = auth.AppendRepositoryScope(ctx, r.Reference, auth.ActionPull) @@ -447,7 +447,7 @@ func (r *Repository) tags(ctx context.Context, last string, fn func(tags []strin // Predecessors returns the descriptors of image or artifact manifests directly // referencing the given manifest descriptor. // Predecessors internally leverages Referrers. -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers func (r *Repository) Predecessors(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { var res []ocispec.Descriptor if err := r.Referrers(ctx, desc, "", func(referrers []ocispec.Descriptor) error { @@ -466,7 +466,7 @@ func (r *Repository) Predecessors(ctx context.Context, desc ocispec.Descriptor) // If artifactType is not empty, only referrers of the same artifact type are // fed to fn. // -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers func (r *Repository) Referrers(ctx context.Context, desc ocispec.Descriptor, artifactType string, fn func(referrers []ocispec.Descriptor) error) error { state := r.loadReferrersState() if state == referrersStateUnsupported { @@ -565,7 +565,7 @@ func (r *Repository) referrersPageByAPI(ctx context.Context, artifactType string referrers := index.Manifests if artifactType != "" { // check both filters header and filters annotations for compatibility - // latest spec for filters header: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers + // latest spec for filters header: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers // older spec for filters annotations: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc1/spec.md#listing-referrers filtersHeader := resp.Header.Get(headerOCIFiltersApplied) filtersAnnotation := index.Annotations[spec.AnnotationReferrersFiltersApplied] @@ -587,7 +587,7 @@ func (r *Repository) referrersPageByAPI(ctx context.Context, artifactType string // referencing the given manifest descriptor by requesting referrers tag. // fn is called for the referrers result. If artifactType is not empty, // only referrers of the same artifact type are fed to fn. -// reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#backwards-compatibility +// reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#backwards-compatibility func (r *Repository) referrersByTagSchema(ctx context.Context, desc ocispec.Descriptor, artifactType string, fn func(referrers []ocispec.Descriptor) error) error { referrersTag := buildReferrersTag(desc) _, referrers, err := r.referrersFromIndex(ctx, referrersTag) @@ -801,7 +801,7 @@ func (s *blobStore) Mount(ctx context.Context, desc ocispec.Descriptor, fromRepo // push it. If the caller has provided a getContent function, we // can use that, otherwise pull the content from the source repository. // - // [spec]: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#mounting-a-blob-from-another-repository + // [spec]: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#mounting-a-blob-from-another-repository var r io.ReadCloser if getContent != nil { @@ -836,7 +836,7 @@ func (s *blobStore) sibling(otherRepoName string) *blobStore { // References: // - https://docs.docker.com/registry/spec/api/#pushing-an-image // - https://docs.docker.com/registry/spec/api/#initiate-blob-upload -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pushing-a-blob-monolithically +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pushing-a-blob-monolithically func (s *blobStore) Push(ctx context.Context, expected ocispec.Descriptor, content io.Reader) error { // start an upload // pushing usually requires both pull and push actions. @@ -1146,7 +1146,7 @@ func (s *manifestStore) deleteWithIndexing(ctx context.Context, target ocispec.D // on manifest delete. // // References: -// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#deleting-manifests +// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#deleting-manifests // - Compatible spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc1/spec.md#deleting-manifests func (s *manifestStore) indexReferrersForDelete(ctx context.Context, desc ocispec.Descriptor, manifestJSON []byte) error { var manifest struct { @@ -1332,7 +1332,7 @@ func (s *manifestStore) push(ctx context.Context, expected ocispec.Descriptor, c // checkOCISubjectHeader checks the "OCI-Subject" header in the response and // sets referrers capability accordingly. -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pushing-manifests-with-subject +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pushing-manifests-with-subject func (s *manifestStore) checkOCISubjectHeader(resp *http.Response) { // If the "OCI-Subject" header is set, it indicates that the registry // supports the Referrers API and has processed the subject of the manifest. @@ -1383,7 +1383,7 @@ func (s *manifestStore) pushWithIndexing(ctx context.Context, expected ocispec.D // on manifest push. // // References: -// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pushing-manifests-with-subject +// - Latest spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pushing-manifests-with-subject // - Compatible spec: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc1/spec.md#pushing-manifests-with-subject func (s *manifestStore) indexReferrersForPush(ctx context.Context, desc ocispec.Descriptor, manifestJSON []byte) error { var subject ocispec.Descriptor @@ -1440,8 +1440,8 @@ func (s *manifestStore) indexReferrersForPush(ctx context.Context, desc ocispec. // updateReferrersIndex updates the referrers index for desc referencing subject // on manifest push and manifest delete. // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#pushing-manifests-with-subject -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#deleting-manifests +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#pushing-manifests-with-subject +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#deleting-manifests func (s *manifestStore) updateReferrersIndex(ctx context.Context, subject ocispec.Descriptor, change referrerChange) (err error) { referrersTag := buildReferrersTag(subject) diff --git a/registry/remote/url.go b/registry/remote/url.go index 903ee088..2d4b422b 100644 --- a/registry/remote/url.go +++ b/registry/remote/url.go @@ -101,7 +101,7 @@ func buildRepositoryBlobMountURL(plainHTTP bool, ref registry.Reference, d diges // buildReferrersURL builds the URL for querying the Referrers API. // Format: :///v2//referrers/?artifactType= -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers func buildReferrersURL(plainHTTP bool, ref registry.Reference, artifactType string) string { var query string if artifactType != "" { diff --git a/registry/remote/warning.go b/registry/remote/warning.go index 5eb98e78..20f5071f 100644 --- a/registry/remote/warning.go +++ b/registry/remote/warning.go @@ -43,7 +43,7 @@ var errUnexpectedWarningFormat = errors.New("unexpected warning format") // WarningValue represents the value of the Warning header. // // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#warnings +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#warnings // - https://www.rfc-editor.org/rfc/rfc7234#section-5.5 type WarningValue struct { // Code is the warn-code. @@ -58,7 +58,7 @@ type WarningValue struct { // other information related to the warning. // // References: -// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#warnings +// - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#warnings // - https://www.rfc-editor.org/rfc/rfc7234#section-5.5 type Warning struct { // WarningValue is the value of the warning header. diff --git a/registry/repository.go b/registry/repository.go index 90c26905..84a50e2a 100644 --- a/registry/repository.go +++ b/registry/repository.go @@ -87,7 +87,7 @@ type ReferenceFetcher interface { } // ReferrerLister provides the Referrers API. -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers type ReferrerLister interface { Referrers(ctx context.Context, desc ocispec.Descriptor, artifactType string, fn func(referrers []ocispec.Descriptor) error) error } @@ -109,7 +109,7 @@ type TagLister interface { // specification. // // References: - // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#content-discovery + // - https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#content-discovery // - https://docs.docker.com/registry/spec/api/#tags // See also `Tags()` in this package. Tags(ctx context.Context, last string, fn func(tags []string) error) error @@ -143,7 +143,7 @@ func Tags(ctx context.Context, repo TagLister) ([]string, error) { // Referrers lists the descriptors of image or artifact manifests directly // referencing the given manifest descriptor. // -// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0-rc4/spec.md#listing-referrers +// Reference: https://github.com/opencontainers/distribution-spec/blob/v1.1.0/spec.md#listing-referrers func Referrers(ctx context.Context, store content.ReadOnlyGraphStorage, desc ocispec.Descriptor, artifactType string) ([]ocispec.Descriptor, error) { if !descriptor.IsManifest(desc) { return nil, fmt.Errorf("the descriptor %v is not a manifest: %w", desc, errdef.ErrUnsupported)