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: proposals/devcontainer-features.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,26 @@ From a practical point of view, features are folders that contain units of code
6
6
7
7
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.
8
8
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
+
10
29
11
30
## Folder Structure
12
31
@@ -52,15 +71,15 @@ The properties of the file are as follows:
52
71
| licenseURL | string | Url that points to the license of the feature. |
53
72
| version | string | Version of the feature. |
54
73
| 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).|
57
74
| options | object | Possible options to be passed as environment variables to the execution of the scripts |
58
75
| containerEnv | object | A set of name value pairs that sets or overrides environment variables. |
59
76
| privileged | boolean | If privileged mode is required by the feature. |
60
77
| init | boolean | If it's necessary to run `init`. |
61
78
| capAdd | array | Additional capabilities needed by the feature. |
62
79
| securityOpt | array | Security options needed by the feature. |
63
80
| 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. |
64
83
65
84
Options
66
85
@@ -90,13 +109,8 @@ In most cases, the `devcontainer-collection.json` file can be generated automati
90
109
91
110
## devcontainer.json properties
92
111
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.
94
113
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 .|
100
114
101
115
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:
102
116
@@ -135,11 +149,9 @@ A release consists of the following:
135
149
136
150
There are several things to keep in mind for an application that implements features:
137
151
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`.
140
153
- Features are used to create an image that can be used to create a container or not.
141
154
- Parameters like `privileged`, `init` are included if just 1 feature requires them.
142
155
- 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