Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating features proposal after latest discussions. #48

Merged
merged 7 commits into from
Jun 29, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions proposals/devcontainer-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@ From a practical point of view, features are folders that contain units of code

Features can be defined by a `devcontainer-feature.json` file in the root folder of the feature. The file is optional for backwards compatibility but it is required for any new features being authored.

Features are to be executed in sequence as defined in `devcontainer.json`.
By default, features are installed in an order selected by the implementing tool.

If any of the following properties in the feature's `devcontainer-feature.json, or the user's `devcontainer.json` are provided, the ordered indicated by the propert(ies) are respected.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved

- `runsAfter` property defined as part of `devcontainer-feature.json`.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- id.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved

edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
The tool uses the `runsAfter` propery to intelligently manage this order and ensure that if there are relationships betwen the features they are respected.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved

An end-user can explicitly provide an installation order for features given the `overrideFeatureInstallOrder` property of `devcontainer.json`.

All feature `id` provided in `overrideFeatureInstallOrder` must also exist in the `features` property of a user's `devcontainer.json`.

The provided features, indicated by `id`, will be installed in the specified order. Any remaining features in the features object that are not mentioned in the array will be installed in an undefined/implicit order, as determined as optimal by the tooling.

| Property | Type | Description |
| :--- | :--- | :--- |
| overrideFeatureInstallOrder | array | Array made of the Id's of the features in the order the user wants them to be installed. |


## Folder Structure

Expand Down Expand Up @@ -90,13 +108,12 @@ In most cases, the `devcontainer-collection.json` file can be generated automati

## devcontainer.json properties

Features are referenced in `devcontainer.json` , where the `features` tag consists of an array with the ordered list of features to be included in the container image.
Features are referenced in `devcontainer.json` , where the `features` tag consists of an object tag starting with the id of the feature and including the values of the options to pass to the feature itself.

The properties are:
| Property | Type | Description |
| :--- | :--- | :--- |
| id | string | Reference to the particular feature to be included. |
| options | object | Type of the option .|
| options | object | Type of the option. |
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved

The `id` is the main reference point for how to find and download a particular feature. `id` can be defined in any of the following ways:

Expand Down Expand Up @@ -135,11 +152,9 @@ A release consists of the following:

There are several things to keep in mind for an application that implements features:

- Features are executed in the order defined in devcontainer.json
- It should be possible to execute a feature multiple times with different parameters.
- The order of execution of features is determined by the application based on the `installAfter` property by feature authors and can be overriden by users if necesarry with the `overrideFeatureInstallOrder` in `devcontainer.json`.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- Features are used to create an image that can be used to create a container or not.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- Parameters like `privileged`, `init` are included if just 1 feature requires them.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- Parameters like `capAdd`, `securityOp` are concatenated.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- ContainerEnv is added before the feature is executed as `ENV` commands in the docker file.
edgonmsft marked this conversation as resolved.
Show resolved Hide resolved
- Features are added to an image in two passes. One for `aquire` scripts and another for `install` scripts.
- Each script executes as its own layer to aid in caching and rebuilding.
- Each feature script executes as its own layer to aid in caching and rebuilding.