Skip to content

Commit c60ea62

Browse files
authored
Updates to Features content (#28)
* Update features-distribution.md * Update features.md
1 parent 213e5f7 commit c60ea62

File tree

2 files changed

+56
-48
lines changed

2 files changed

+56
-48
lines changed

_implementors/features-distribution.md

+31-23
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Goals include:
2323

2424
Features source code is stored in a git repository.
2525

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>`).
2727

2828
Source code for the set follows the example file structure below:
2929

@@ -53,25 +53,25 @@ Source code for the set follows the example file structure below:
5353
├── ...
5454
```
5555

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.
5757

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).
5959

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.
6161

6262
## <a href="#versioning" name="versioning" class="anchor"> Versioning </a>
6363

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.
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.
6565

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.
6767

6868
## <a href="#packaging" name="packaging" class="anchor"> Packaging </a>
6969

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.
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.
7171

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.
7373

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).
7575

7676
### <a href="#devcontainer-collection-json" name="devcontainer-collection-json" class="anchor"> devcontainer-collection.json </a>
7777

@@ -83,25 +83,25 @@ The `devcontainer-collection.json` is an auto-generated metadata file.
8383
| `features` | array | The list of features that are contained in this collection.|
8484
{: .table .table-bordered .table-responsive}
8585

86-
Each features's `devcontainer-feature.json` metadata file is appended into the `features` top-level array.
86+
Each Features's `devcontainer-feature.json` metadata file is appended into the `features` top-level array.
8787

8888
## <a href="#distribution" name="distribution" class="anchor"> Distribution </a>
8989

90-
There are several supported ways to distribute features. Distribution is handled by the implementing packaging tool.
90+
There are several supported ways to distribute Features. Distribution is handled by the implementing packaging tool.
9191

92-
A user references a distributed feature in a `devcontainer.json` as defined in ['referencing a feature'](../features#referencing-a-feature).
92+
A user references a distributed Feature in a `devcontainer.json` as defined in ['referencing a feature'](../features#referencing-a-feature).
9393

9494
### <a href="#oci-registry" name="oci-registry" class="anchor"> OCI Registry </a>
9595

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.
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.
9797

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.
9999

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>`.
101101
102102
A custom media type `application/vnd.devcontainers` and `application/vnd.devcontainers.layer.v1+tar` are used as demonstrated below.
103103

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.
105105

106106
> **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.
107107
@@ -121,7 +121,7 @@ do
121121
done
122122
```
123123

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).
125125

126126
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`.
127127

@@ -143,15 +143,23 @@ The `.tgz` archive file must be named `devcontainer-feature-<featureId>.tgz`.
143143

144144
### <a href="#addendum-locally-referenced" name="addendum-locally-referenced" class="anchor"> Locally referenced Features </a>
145145

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.
147147

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`**.
149149

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:
151151

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).
153153

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.
155163

156164
An example project is illustrated below:
157165

@@ -178,4 +186,4 @@ An example project is illustrated below:
178186
"./localFeatureB": {}
179187
}
180188
}
181-
```
189+
```

0 commit comments

Comments
 (0)