You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _implementors/features-distribution.md
+31-23
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Goals include:
23
23
24
24
Features source code is stored in a git repository.
25
25
26
-
For ease of authorship and maintenance, [1..n] features can share a single git repository. This set of features is referred to as a "collection," and will share the same [`devcontainer-collection.json`](#devcontainer-collection.json) file and "namespace" (eg. `<owner>/<repo>`).
26
+
For ease of authorship and maintenance, [1..n] features can share a single git repository. This set of Features is referred to as a "collection," and will share the same [`devcontainer-collection.json`](#devcontainer-collection.json) file and "namespace" (eg. `<owner>/<repo>`).
27
27
28
28
Source code for the set follows the example file structure below:
29
29
@@ -53,25 +53,25 @@ Source code for the set follows the example file structure below:
53
53
├── ...
54
54
```
55
55
56
-
... where `src` is a directory containing a sub-folder with the name of the feature (e.g. `src/dotnet` or `src/go`) with at least a file named `devcontainer-feature.json` that contains the feature metadata, and an `install.sh` script that implementing tools will use as the entrypoint to install the feature.
56
+
... where `src` is a directory containing a sub-folder with the name of the Feature (e.g. `src/dotnet` or `src/go`) with at least a file named `devcontainer-feature.json` that contains the Feature metadata, and an `install.sh` script that implementing tools will use as the entrypoint to install the Feature.
57
57
58
-
Each sub-directory should be named such that it matches the `id` field of the `devcontainer-feature.json`. Other files can also be included in the feature's sub-directory, and will be included during the [packaging step](#packaging) alongside the two required files. Any files that are not part of the feature's sub-directory (e.g. outside of `src/dotnet`) will not included in the [packaging step](#packaging).
58
+
Each sub-directory should be named such that it matches the `id` field of the `devcontainer-feature.json`. Other files can also be included in the Feature's sub-directory, and will be included during the [packaging step](#packaging) alongside the two required files. Any files that are not part of the Feature's sub-directory (e.g. outside of `src/dotnet`) will not included in the [packaging step](#packaging).
59
59
60
-
Optionally, a mirrored `test` directory can be included with an accompanying `test.sh` script. Implementing tools may use this to run tests against the given feature.
60
+
Optionally, a mirrored `test` directory can be included with an accompanying `test.sh` script. Implementing tools may use this to run tests against the given Feature.
Each feature is individually [versioned according to the semver specification](https://semver.org/). The `version` property in the respective `devcontainer-feature.json` file is parsed to determine if the feature should be republished.
64
+
Each Feature is individually [versioned according to the semver specification](https://semver.org/). The `version` property in the respective `devcontainer-feature.json` file is parsed to determine if the Feature should be republished.
65
65
66
-
Tooling that handles publishing features will not republish features if that exact version has already been published; however, tooling must republish major and minor versions in accordance with the semver specification.
66
+
Tooling that handles publishing Features will not republish Features if that exact version has already been published; however, tooling must republish major and minor versions in accordance with the semver specification.
Features are distributed as tarballs. The tarball contains the entire contents of the feature sub-directory, including the `devcontainer-feature.json`, `install.sh`, and any other files in the directory.
70
+
Features are distributed as tarballs. The tarball contains the entire contents of the Feature sub-directory, including the `devcontainer-feature.json`, `install.sh`, and any other files in the directory.
71
71
72
-
The tarball is named `devcontainer-feature-<id>.tgz`, where `<id>` is the feature's `id` field.
72
+
The tarball is named `devcontainer-feature-<id>.tgz`, where `<id>` is the Feature's `id` field.
73
73
74
-
A reference implementation for packaging and distributing features is provided as a GitHub Action (https://github.com/devcontainers/action).
74
+
A reference implementation for packaging and distributing Features is provided as a GitHub Action (https://github.com/devcontainers/action).
An OCI registry that implements the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec) serves as the primary distribution mechanism for features.
96
+
An OCI registry that implements the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec) serves as the primary distribution mechanism for Features.
97
97
98
-
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.
98
+
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.
99
99
100
-
> **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>`.
100
+
> **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>`.
101
101
102
102
A custom media type `application/vnd.devcontainers` and `application/vnd.devcontainers.layer.v1+tar` are used as demonstrated below.
103
103
104
-
For example, the `go`feature in the `devcontainers/features` namespace at version `1.2.3` would be pushed to the ghcr.io OCI registry.
104
+
For example, the `go`Feature in the `devcontainers/features` namespace at version `1.2.3` would be pushed to the ghcr.io OCI registry.
105
105
106
106
> **Note:** The example below uses [`oras`](https://oras.land/) for demonstration purposes. A supporting tool should directly implement the required functionality from the aforementioned OCI artifact distribution specification.
107
107
@@ -121,7 +121,7 @@ do
121
121
done
122
122
```
123
123
124
-
The "namespace" is the globally identifiable name for the collection of features. (eg: `owner/repo` for the source code's git repository).
124
+
The "namespace" is the globally identifiable name for the collection of Features. (eg: `owner/repo` for the source code's git repository).
125
125
126
126
The auto-generated `devcontainer-collection.json` is pushed to the registry with the same `namespace` as above and no accompanying `feature` name. The collection file is always tagged as `latest`.
127
127
@@ -143,15 +143,23 @@ The `.tgz` archive file must be named `devcontainer-feature-<featureId>.tgz`.
143
143
144
144
### <ahref="#addendum-locally-referenced"name="addendum-locally-referenced"class="anchor"> Locally referenced Features </a>
145
145
146
-
To aid in feature authorship, or in instances where a feature should not be published externally, individual features can be referenced locally from the project's file tree.
146
+
Instead of publishing a Feature to an OCI registry, a Feature's source code may be referenced from a local folder. Locally referencing a Feature may be useful when first authoring a Feature.
147
147
148
-
A local feature is placed in a `.devcontainer/` folder at the root of the [**project workspace folder**](../spec#a-hrefproject-workspace-folder-classanchor-project-workspace-folder-a) and referenced in a user's [`.devcontainer/devcontainer.json`](../spec#a-hrefdevcontainerjson-namedevcontainerjson-classanchor-devcontainerjson-a) by relative path.
148
+
A local Feature is referenced in the devcontainer's `feature` object **relative to the folder containing the project's `devcontainer.json`**.
149
149
150
-
The relative path is provided using unix-style path syntax (eg `./<...>`), regardless of the host operating system.
150
+
Additional constraints exists when including local Features in a project:
151
151
152
-
A local feature may **not** be referenced by absolute path, or by a path outside the `.devcontainer/`folder.
152
+
* The project must have a `.devcontainer/` folder at the root of the [**project workspace folder**](/docs/specs/devcontainer-reference.md#project-workspace-folder).
153
153
154
-
The provided relative path is a path to the folder containing at least a `devcontainer-feature.json` and `install.sh` file, mirroring the structure [previously outlined](#Source-Code).
154
+
* A local Feature's source code **must** be contained within a sub-folder of the `.devcontainer/ folder`.
155
+
156
+
* The sub-folder name **must** match the Feature's `id` field.
157
+
158
+
* A local Feature may **not** be referenced by absolute path.
159
+
160
+
* The local Feature's sub-folder **must** contain at least a `devcontainer-feature.json` file and `install.sh` entrypoint script, mirroring the [previously outlined file structure](#Source-code).
161
+
162
+
The relative path is provided using unix-style path syntax (eg `./myFeature`) regardless of the host operating system.
155
163
156
164
An example project is illustrated below:
157
165
@@ -178,4 +186,4 @@ An example project is illustrated below:
0 commit comments