|
| 1 | +# OCI ORAS Project Proposal # |
| 2 | + |
| 3 | +## Abstract ## |
| 4 | + |
| 5 | +The ORAS project (https://github.com/deislabs/oras) is a CLI that can publish arbitrary content to an OCI registry, with special features for setting mediatypes on manifest configs and on content. |
| 6 | + |
| 7 | +In order to provide OCI end users a method to publish and retrieve any type of content to/from an OCI registry, as well as a reference implementation for the in-progress artifacts spec, ORAS should be moved under the opencontainers GitHub org. |
| 8 | + |
| 9 | +### ORAS Details ### |
| 10 | + |
| 11 | + |
| 12 | +ORAS is a CLI that can publish arbitrary content to an OCI registry, with special features for setting mediatypes on manifest configs and on content. |
| 13 | + |
| 14 | +Note: the manifest mediatype itself is always `application/vnd.oci.image.manifest.v1+json`. |
| 15 | + |
| 16 | +Example - uploading rockets, a brand new type of package: |
| 17 | + |
| 18 | +``` |
| 19 | +# Create a thing |
| 20 | +printf '🚀' > rocket.txt |
| 21 | +
|
| 22 | +# Create a manifest config |
| 23 | +printf '{"RocketVersion":"v0.1.0"}' > rocket-config.json |
| 24 | +
|
| 25 | +# Upload your thing with a custom mediatype |
| 26 | +oras push localhost:5000/mystuff/myrocket:v0.1.0 rocket.txt:text/plain \ |
| 27 | + --manifest-config rocket-config.json:application/vnd.acme.rocket.config.v1+json |
| 28 | + ``` |
| 29 | + |
| 30 | +See manifest created: |
| 31 | + |
| 32 | +``` |
| 33 | +$ curl -s -H 'Accept: application/vnd.oci.image.manifest.v1+json' \ |
| 34 | + http://localhost:5000/v2/mystuff/myrocket/manifests/v0.1.0 | jq |
| 35 | +{ |
| 36 | + "schemaVersion": 2, |
| 37 | + "config": { |
| 38 | + "mediaType": "application/vnd.acme.rocket.config.v1+json", |
| 39 | + "digest": "sha256:310175f34d2d4d5cba3418be06ddd1ef948147d729516d78318ec7f5c2d83d49", |
| 40 | + "size": 26 |
| 41 | + }, |
| 42 | + "layers": [ |
| 43 | + { |
| 44 | + "mediaType": "text/plain", |
| 45 | + "digest": "sha256:ebbc0b2870eb323f2b6cffa5c493ceef81ae7eb36afc73d4e0367301631daec5", |
| 46 | + "size": 4, |
| 47 | + "annotations": { |
| 48 | + "org.opencontainers.image.title": "rocket.txt" |
| 49 | + } |
| 50 | + } |
| 51 | + ] |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +Get that thing: |
| 56 | + |
| 57 | +``` |
| 58 | +$ curl -s http://localhost:5000/v2/mystuff/myrocket/blobs/sha256:ebbc0b2870eb323f2b6cffa5c493ceef81ae7eb36afc73d4e0367301631daec5 |
| 59 | +🚀 |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +#### Additional Usage #### |
| 64 | + |
| 65 | +ORAS is built primarily on top of Go packages provided by [containerd](github.com/containerd/containerd), but it also imports packages from the [docker/cli](https://github.com/docker/cli), which enables "docker-style" auth login: |
| 66 | + |
| 67 | +``` |
| 68 | +oras login -u username -p password localhost:5000 -c rocket-creds.json |
| 69 | +``` |
| 70 | + |
| 71 | +There are also public Go packages available to build on top of ORAS. The following is the equivalent of the rocket example with the CLI above, but in Go: |
| 72 | + |
| 73 | +```go |
| 74 | +package main |
| 75 | + |
| 76 | +import ( |
| 77 | + "context" |
| 78 | + "fmt" |
| 79 | + |
| 80 | + "github.com/containerd/containerd/remotes/docker" |
| 81 | + "github.com/deislabs/oras/pkg/content" |
| 82 | + "github.com/deislabs/oras/pkg/oras" |
| 83 | + ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 84 | +) |
| 85 | + |
| 86 | +func main() { |
| 87 | + ctx := context.Background() |
| 88 | + resolver := docker.NewResolver(docker.ResolverOptions{}) |
| 89 | + store := content.NewMemoryStore() |
| 90 | + |
| 91 | + registryRootURL := "localhost:5000" |
| 92 | + registryNamespace := "mystuff/myrocket" |
| 93 | + |
| 94 | + rocketVersion := "v0.1.0" |
| 95 | + rocketFileName := "rocket.txt" |
| 96 | + rocketMediaType := "text/plain" |
| 97 | + rocketContent := []byte("🚀") |
| 98 | + rocketDescriptor := store.Add(rocketFileName, rocketMediaType, rocketContent) |
| 99 | + |
| 100 | + rocketConfigMediaType := "application/vnd.acme.rocket.config.v1+json" |
| 101 | + rocketConfigContent := []byte(fmt.Sprintf("{\"RocketVersion\":\"%s\"}", rocketVersion)) |
| 102 | + rocketConfigDescriptor := store.Add("", rocketConfigMediaType, rocketConfigContent) |
| 103 | + |
| 104 | + ref := fmt.Sprintf("%s/%s:%s", registryRootURL, registryNamespace, rocketVersion) |
| 105 | + _, err := oras.Push(ctx, resolver, ref, store, []ocispec.Descriptor{rocketDescriptor}, |
| 106 | + oras.WithConfig(rocketConfigDescriptor)) |
| 107 | + if err != nil { |
| 108 | + panic(err) |
| 109 | + } |
| 110 | + |
| 111 | + fmt.Println("Pushed to", ref) |
| 112 | + fmt.Printf("\nTry:\n\ncurl -s -H 'Accept: application/vnd.oci.image.manifest.v1+json' \\\n" + |
| 113 | + " %s/v2/%s/manifests/%s | jq\n", registryRootURL, registryNamespace, rocketVersion) |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +You can see all features in the project [README](https://github.com/deislabs/oras/blob/master/README.md). |
| 118 | + |
| 119 | +#### Adoption #### |
| 120 | + |
| 121 | +The following projects are already successfully using ORAS to work with custom artifacts: |
| 122 | + |
| 123 | +- [Helm](https://github.com/helm/helm/search?q=oras) |
| 124 | +- [Conftest](https://github.com/instrumenta/conftest/search?q=oras) |
| 125 | +- [Singularity](https://github.com/sylabs/singularity/search?q=oras) |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +## Proposal ## |
| 130 | +Change the ownership of the existing umoci project from deislabs: |
| 131 | + |
| 132 | + https://github.com/deislabs/oras |
| 133 | + |
| 134 | +And move it inside the `opencontainers` organization: |
| 135 | + |
| 136 | + https://github.com/opencontainers/oras |
| 137 | + |
| 138 | +The import paths will correspondingly be "github.com/opencontainers/oras" (oras does have some Go API users, but since the project will be renamed -- and GitHub will add a redirect -- there will be no significant downstream impact of the change). |
| 139 | + |
| 140 | +### Initial Maintainers ### |
| 141 | +Initial maintainers of the ORAS project would be: |
| 142 | + |
| 143 | +* Josh Dolitsky <[email protected]> ( @jdolitsky) |
| 144 | +* Shiwei Zhang <[email protected]> ( @shizhMSFT) |
| 145 | +* Sajay Antony <[email protected]> ( @sajayantony) |
| 146 | +* Steve Lasker < [email protected]> ( @stevelasker) |
| 147 | +* Jimmy Zelinskie <[email protected]> ( @jzelinskie) |
| 148 | +* Matt Fisher < [email protected]> ( @bacongobbler) |
| 149 | + |
| 150 | +### Code of Conduct ### |
| 151 | +This project would incorporate (by reference) the OCI [Code of Conduct][code-of-conduct]. |
| 152 | + |
| 153 | +[code-of-conduct]: https://github.com/opencontainers/org/blob/master/CODE_OF_CONDUCT.md |
| 154 | + |
| 155 | +### Governance and Releases ### |
| 156 | +This project would incorporate the Governance and Releases processes from the OCI project template: https://github.com/opencontainers/project-template. |
| 157 | + |
| 158 | +It should be noted that since ORAS is not a specification, it is not bound by the ordinary quorum and voting rules for specification release. |
| 159 | +As such, new versions will be released as regularly as needed without the need for a quorum vote. |
| 160 | + |
| 161 | +Until there are enough additional maintainers, PRs will be merged with only one maintainer LGTM required. |
| 162 | +Maintainers are encouraged to not merge their own PRs immediately (preferably waiting at least 24 to 48 hours to allow another maintainer to review it), but this is not a strict rule. |
| 163 | + |
| 164 | +### Project Communications ### |
| 165 | +The proposed project would continue to use existing channels in use by the OCI developer community for communication including: |
| 166 | + |
| 167 | + * GitHub for issues and pull requests. |
| 168 | + * The [`[email protected]`][oci-ml] email list. |
| 169 | + * The weekly OCI developer community conference call. |
| 170 | + * The `#opencontainers` IRC channel on Freenode. |
| 171 | + * The [OCI Slack workspace][oci-slack]. |
| 172 | + * The [OCI Matrix Room][oci-matrix]. |
| 173 | + |
| 174 | +[oci-ml]: mailto:[email protected] |
| 175 | +[oci-slack]: https://opencontainers.slack.com/ |
| 176 | +[oci-matrix]: https://matrix.to/#/#opencontainers:matrix.org |
| 177 | + |
0 commit comments