Skip to content

Commit

Permalink
Add Feature Dependencies changes to main spec (#292)
Browse files Browse the repository at this point in the history
* Add Feature Dependencies changes to main spec (#109)

* some proofreading

* Update docs/specs/devcontainer-features.md

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update devcontainer-features.md

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
  • Loading branch information
joshspicer and samruddhikhandale committed Aug 23, 2023
1 parent d9aa56a commit 9ba6c9e
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 28 deletions.
33 changes: 31 additions & 2 deletions docs/specs/devcontainer-features-distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ A user references a distributed feature in a `devcontainer.json` as defined in [

### OCI Registry

An OCI registry that implements the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec) serves as the primary distribution mechanism for features.
An OCI registry that implements the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec) serves as the primary distribution mechanism for Features.

Each packaged feature is pushed to the registry following the naming convention `<registry>/<namespace>/<id>[:version]`, where version is the major, minor, and patch version of the feature, according to the semver specification.

> **Note:** The `namespace` is a unique indentifier for the collection of features. There are no strict rules for the `namespace`; however, one pattern is to set `namespace` equal to source repository's `<owner>/<repo>`. The `namespace` should be lowercase, following [the regex provided in the OCI specification](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifests).
> **Note:** The `namespace` is a unique identifier for the collection of features. There are no strict rules for the `namespace`; however, one pattern is to set `namespace` equal to source repository's `<owner>/<repo>`. The `namespace` should be lowercase, following [the regex provided in the OCI specification](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifests).
A custom media type `application/vnd.devcontainers` and `application/vnd.devcontainers.layer.v1+tar` are used as demonstrated below.

Expand Down Expand Up @@ -132,6 +132,35 @@ oras push ${REGISTRY}/${NAMESPACE}:latest \
./devcontainer-collection.json:application/vnd.devcontainers.collection.layer.v1+json
```

Additionally, an [annotation](https://github.com/opencontainers/image-spec/blob/main/annotations.md) named `dev.containers.metadata` should be populated on the manifest when published by an implementing tool. This annotation is the escaped JSON object of the entire `devcontainer-feature.json` as it appears during the [packaging stage](https://containers.dev/implementors/features-distribution/#packaging).

An example manifest with the `dev.containers.metadata` annotation:

```json
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.devcontainers",
"digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 0
},
"layers": [
{
"mediaType": "application/vnd.devcontainers.layer.v1+tar",
"digest": "sha256:738af5504b253dc6de51d2cb1556cdb7ce70ab18b2f32b0c2f12650ed6d2e4bc",
"size": 3584,
"annotations": {
"org.opencontainers.image.title": "devcontainer-feature-myFeature.tgz"
}
}
],
"annotations": {
"dev.containers.metadata": "{\"name\": \"My Feature\",\"id\": \"myFeature\",\"version\": \"1.0.0\",\"dependsOn\": {\"ghcr.io/myotherFeature:1\": {\"flag\": true},\"features.azurecr.io/aThirdFeature:1\": {},\"features.azurecr.io/aFourthFeature:1.2.3\": {}}}"
}
}
```

### Directly referencing a tarball

A Feature can be referenced directly in a user's [`devcontainer.json`](/docs/specs/devcontainer-reference.md#devcontainerjson) file by HTTPS URI that points to the tarball from the [package step](#packaging).
Expand Down
Loading

0 comments on commit 9ba6c9e

Please sign in to comment.