Skip to content

Commit 0eae45d

Browse files
Features - Document 'legacyIds' (devcontainers#114)
* GH Pages - Document 'legacyIds' * nit
1 parent 2777bfa commit 0eae45d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

_implementors/features.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The properties of the file are as follows:
5151
| `entrypoint` | string | Set if the feature requires an "entrypoint" script that should fire at container start up. |
5252
| `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. |
5353
| `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. |
54+
| `legacyIds` | array | Array of old IDs used to publish this Feature. The property is useful for renaming a currently published Feature within a single namespace. |
5455
| `deprecated` | boolean | Indicates that the Feature is deprecated, and will not receive any further updates/support. This property is intended to be used by the supporting tools for highlighting Feature deprecation. |
5556
{: .table .table-bordered .table-responsive}
5657

@@ -362,6 +363,46 @@ Pip? false
362363
Optimize? true
363364
```
364365

366+
### <a href="#steps-to-rename-a-feature" name="steps-to-rename-a-feature" class="anchor"> Steps to rename a Feature </a>
367+
368+
1. Update the Feature [source code](./features-distribution.md#source-code) folder and the `id` property in the [devcontainer-feature.json properties](#devcontainer-featurejson-properties) to reflect the new `id`. Other properties (`name`, `documentationUrl`, etc.) can optionally be updated during this step.
369+
2. Add or update the `legacyIds` property to the Feature, including the previously used `id`.
370+
3. Bump the semantic version of the Feature.
371+
4. Rerun the `devcontainer features publish` command, or equivalent tool that implements the [Features distribution specification](./features-distribution.md#distribution).
372+
373+
#### Example: Renaming a Feature
374+
375+
Let's say we currently have a `docker-from-docker` Feature 👇
376+
377+
Current `devcontainer-feature.json` :
378+
379+
```jsonc
380+
{
381+
"id": "docker-from-docker",
382+
"version": "2.0.1",
383+
"name": "Docker (Docker-from-Docker)",
384+
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-from-docker",
385+
....
386+
}
387+
```
388+
389+
We'd want to rename this Feature to `docker-outside-of-docker`. The source code folder of the Feature will be updated to `docker-outside-of-docker` and the updated `devcontainer-feature.json` will look like 👇
390+
391+
```jsonc
392+
{
393+
"id": "docker-outside-of-docker",
394+
"version": "2.0.2",
395+
"name": "Docker (Docker-outside-of-Docker)",
396+
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker",
397+
"legacyIds": [
398+
"docker-from-docker"
399+
]
400+
....
401+
}
402+
```
403+
404+
**Note** - The semantic version of the Feature defined by the `version` property should be **continued** and should not be restarted at `1.0.0`.
405+
365406
### <a href="#implementation-notes" name="implementation-notes" class="anchor"> Implementation notes </a>
366407

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

0 commit comments

Comments
 (0)