Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Commit c70ec71

Browse files
committed
Add spec for Artifacts
Signed-off-by: Aviral Takkar <aviral26@users.noreply.github.com>
1 parent 9d10a67 commit c70ec71

7 files changed

Lines changed: 51 additions & 47 deletions

File tree

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/notaryproject/artifacts
2+
3+
go 1.16
4+
5+
require github.com/opencontainers/go-digest v1.0.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
2+
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=

specs-go/v2/artifact.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package v2
2+
3+
import "github.com/notaryproject/artifacts/specs-go"
4+
5+
// Artifact describes a registry artifact.
6+
// This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON.
7+
type Artifact struct {
8+
specs.Versioned
9+
10+
// MediaType is the media type of the object this schema refers to.
11+
MediaType string `json:"mediaType"`
12+
13+
// ArtifactType is the artifact type of the object this schema refers to.
14+
ArtifactType string `json:"artifactType"`
15+
16+
// Config references the configuration of the object this schema refers to. It is optional.
17+
Config *Descriptor `json:"config,omitempty"`
18+
19+
// Blobs is a collection of blobs referenced by this manifest.
20+
Blobs []Descriptor `json:"blobs"`
21+
22+
// Manifests is a collection of manifests this artifact is linked to.
23+
Manifests []Descriptor `json:"manifests"`
24+
25+
// Annotations contains arbitrary metadata for the artifact manifest.
26+
Annotations map[string]string `json:"annotations,omitempty"`
27+
}

specs-go/v2/artifacttype.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v2
2+
3+
const (
4+
// ArtifactTypeNotaryV2 specifies the artifact type for a notary V2 object.
5+
ArtifactTypeNotaryV2 = "application/vnd.cncf.notary.v2"
6+
)

specs-go/v2/index.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

specs-go/v2/mediatype.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
// Copyright 2016 The Linux Foundation
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
14-
151
package v2
162

173
const (
18-
// MediaTypeImageIndex specifies the media type for an image index.
19-
MediaTypeImageIndex = "application/vnd.oci.image.index.v2+json"
4+
// MediaTypeArtifactManifest specifies the media type for an OCI artifact.
5+
MediaTypeArtifactManifest = "application/vnd.oci.artifact.manifest.v1+json"
206
)

specs-go/versioned.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package specs
2+
3+
// Versioned provides a struct with the manifest schemaVersion and mediaType.
4+
// Incoming content with unknown schema version can be decoded against this
5+
// struct to check the version.
6+
type Versioned struct {
7+
// SchemaVersion is the image manifest schema that this image follows
8+
SchemaVersion int `json:"schemaVersion"`
9+
}

0 commit comments

Comments
 (0)