|
1 |
| -Goal: Adds support for renaming and deprecating a Feature. |
| 1 | +# Renaming and Deprecating Features |
| 2 | + |
| 3 | +This has now been implemented: |
| 4 | +* Discussion issue: https://github.com/devcontainers/spec/issues/146 |
| 5 | +* CLI PR: https://github.com/devcontainers/cli/pull/346, https://github.com/devcontainers/cli/pull/335 |
| 6 | + |
| 7 | +Below is the original proposal. |
| 8 | + |
| 9 | +## Goal |
| 10 | + |
| 11 | +Adds support for renaming and deprecating a Feature. |
2 | 12 |
|
3 | 13 | Adding two new properties to the [devcontainer-feature.json](../docs/specs/devcontainer-features.md#devcontainer-featurejson-properties) 👇
|
4 | 14 |
|
5 |
| -# 1. legacyIds |
| 15 | +## 1. legacyIds |
6 | 16 |
|
7 | 17 | | Property | Type | Description |
|
8 | 18 | | :--- | :--- | :--- |
|
9 | 19 | | `legacyIds` | array | Defaults to `[]`. Array of old IDs used to publish this Feature. The property is useful for renaming a currently published Feature within a single namespace. |
|
10 | 20 |
|
11 |
| -## Steps to rename a Feature |
| 21 | +### Steps to rename a Feature |
12 | 22 |
|
13 | 23 | 1. Update the Feature [source code](../docs/specs/features-distribution/#source-code) folder and the `id` property in the [devcontainer-feature.json properties](../docs/specs/devcontainer-features.md#devcontainer-featurejson-properties) to reflect the new `id`. Other properties (`name`, `documentationUrl`, etc.) can optionally be updated during this step.
|
14 | 24 | 2. Add or update the `legacyIds` property to the Feature, including the previously used `id`.
|
15 | 25 | 3. Bump the semantic version of the Feature.
|
16 | 26 | 4. Rerun the `devcontainer features publish` command, or equivalent tool that implements the [Features distribution specification](../docs/specs/features-distribution/#distribution).
|
17 | 27 |
|
18 |
| -### Example: Renaming a Feature |
| 28 | +#### Example: Renaming a Feature |
19 | 29 |
|
20 | 30 | Let's say we currently have a `docker-from-docker` Feature 👇
|
21 | 31 |
|
@@ -48,24 +58,24 @@ We'd want to rename this Feature to `docker-outside-of-docker`. The source code
|
48 | 58 |
|
49 | 59 | **Note** - The semantic version of the Feature defined by the `version` property should be **continued** and should not be restarted at `1.0.0`.
|
50 | 60 |
|
51 |
| -### Changes to the Features distribution specification |
| 61 | +#### Changes to the Features distribution specification |
52 | 62 |
|
53 | 63 | - [Tools implementing the Dev Container Features Distribution Specification](../docs/specs/features-distribution/#distribution) (eg: [Dev Container CLI](https://github.com/devcontainers/cli) and [Dev Container Publish GitHub Action](https://github.com/marketplace/actions/dev-container-publish)) will dual publish the old `id`s (defined by the `legacyIds` property), and the new `id`.
|
54 | 64 | - The [putManifestWithTags](https://github.com/devcontainers/cli/blob/main/src/spec-configuration/containerCollectionsOCIPush.ts#L172) will be modified. The same `tgz` file for the `id` will be pushed to the `id`s mentioned by the `legacyIds` property for all the [tags](https://github.com/devcontainers/cli/blob/main/src/spec-configuration/containerCollectionsOCIPush.ts#L175).
|
55 | 65 |
|
56 |
| -### Supporting backwards compatibility for [`installsAfter`](../docs/specs/devcontainer-features.md#2-the-installsafter-feature-property) property |
| 66 | +#### Supporting backwards compatibility for [`installsAfter`](../docs/specs/devcontainer-features.md#2-the-installsafter-feature-property) property |
57 | 67 |
|
58 | 68 | - Currently the `installsAfter` property is defined as an array consisting of the Feature `id` that should be installed before the given Feature.
|
59 | 69 | - The Feature to be renamed could be already defined by other Feature authors in their `installsAfter` property. Renaming the `id` could change the installation order for them if the `installsAfter` property is not updated with the new `id`. In order to avoid this unexpected behavior and to support back compat, the CLI tooling will be updated to also look at the `legacyIds` property along with the `id` for determining the installation order.
|
60 | 70 |
|
61 |
| - ### Supporting tools |
| 71 | + #### Supporting tools |
62 | 72 |
|
63 | 73 | This property can be used by the supporting tools to indicate Feature rename in few ways
|
64 | 74 | - [Dev Container Publish GitHub Action](https://github.com/devcontainers/action) which auto-generates the README files can add a note with a list of old `id`s which were used to publish this Feature.
|
65 | 75 | - In the scenarios where Dev Configs are referencing the old `id`s, the VS Code extension hints could be enhanced to deliver this warning that the `id` was renamed to a new one.
|
66 | 76 | - The [containers.dev/features](https://containers.dev/features) website, and [supporting tools](https://containers.dev/supporting) like [VS Code Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and [GitHub Codespaces](https://github.com/features/codespaces) wouldn't list the old `id`, instead list the new `id` of Features.
|
67 | 77 |
|
68 |
| -# 2. deprecated |
| 78 | +## 2. deprecated |
69 | 79 |
|
70 | 80 | | Property | Type | Description |
|
71 | 81 | | :--- | :--- | :--- |
|
|
0 commit comments