Skip to content

Commit 7ff8d1f

Browse files
authored
Merge pull request #48 from edgonmsft/features-update
Updating features proposal after latest discussions.
2 parents 310dbac + 36b63c9 commit 7ff8d1f

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

proposals/devcontainer-features.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@ From a practical point of view, features are folders that contain units of code
66

77
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.
88

9-
Features are to be executed in sequence as defined in `devcontainer.json`.
9+
By default, features are installed in an order selected by the implementing tool.
10+
11+
If any of the following properties are provided in the feature's `devcontainer-feature.json`, or the user's `devcontainer.json`, the order indicated by the propert(ies) are respected.
12+
13+
- `installsAfter` property defined as part of `devcontainer-feature.json`.
14+
- `id`.
15+
- `overrideFeatureInstallOrder` in `devcontainer.json`. Allows users to control the order of execution of their features.
16+
17+
The tool uses the `runsAfter` property to intelligently manage this order and ensure that if there are relationships between the features, they are respected.
18+
19+
An end-user can explicitly provide an installation order for features given the `overrideFeatureInstallOrder` property of `devcontainer.json`.
20+
21+
All feature `id` provided in `overrideFeatureInstallOrder` must also exist in the `features` property of a user's `devcontainer.json`.
22+
23+
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.
24+
25+
| Property | Type | Description |
26+
| :--- | :--- | :--- |
27+
| overrideFeatureInstallOrder | array | Array made of the Id's of the features in the order the user wants them to be installed. |
28+
1029

1130
## Folder Structure
1231

@@ -52,15 +71,15 @@ The properties of the file are as follows:
5271
| licenseURL | string | Url that points to the license of the feature. |
5372
| version | string | Version of the feature. |
5473
| keywords | array | List of keywords relevant to a user that would search for this definition/feature. |
55-
| install.app | string | App to execute.|
56-
| install.file | string | Parameters/script to execute (defaults to install.sh).|
5774
| options | object | Possible options to be passed as environment variables to the execution of the scripts |
5875
| containerEnv | object | A set of name value pairs that sets or overrides environment variables. |
5976
| privileged | boolean | If privileged mode is required by the feature. |
6077
| init | boolean | If it's necessary to run `init`. |
6178
| capAdd | array | Additional capabilities needed by the feature. |
6279
| securityOpt | array | Security options needed by the feature. |
6380
| entrypoint | string | Set if the feature requires an entrypoint. |
81+
| customizations | object | Product specific properties, each namespace under `customizations` is treated as a separate set of properties. For each of this sets the object is parsed, values are replaced while arrays are set as a union. |
82+
| installsAfter | array | Array of Id's of features that should execute before this one. Allows control for feature authors on soft dependencies between different features. |
6483

6584
Options
6685

@@ -90,13 +109,8 @@ In most cases, the `devcontainer-collection.json` file can be generated automati
90109

91110
## devcontainer.json properties
92111

93-
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.
112+
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.
94113

95-
The properties are:
96-
| Property | Type | Description |
97-
| :--- | :--- | :--- |
98-
| id | string | Reference to the particular feature to be included. |
99-
| options | object | Type of the option .|
100114

101115
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:
102116

@@ -135,11 +149,9 @@ A release consists of the following:
135149

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

138-
- Features are executed in the order defined in devcontainer.json
139-
- It should be possible to execute a feature multiple times with different parameters.
152+
- The order of execution of features is determined by the application, based on the `installAfter` property used by feature authors. It can be overridden by users if necessary with the `overrideFeatureInstallOrder` in `devcontainer.json`.
140153
- Features are used to create an image that can be used to create a container or not.
141154
- Parameters like `privileged`, `init` are included if just 1 feature requires them.
142155
- Parameters like `capAdd`, `securityOp` are concatenated.
143-
- ContainerEnv is added before the feature is executed as `ENV` commands in the docker file.
144-
- Features are added to an image in two passes. One for `aquire` scripts and another for `install` scripts.
145-
- Each script executes as its own layer to aid in caching and rebuilding.
156+
- `containerEnv` is added before the feature is executed as `ENV` commands in the Dockerfile.
157+
- Each feature script executes as its own layer to aid in caching and rebuilding.

0 commit comments

Comments
 (0)