Skip to content

Commit 44c75b8

Browse files
adds back semver
1 parent 081d86b commit 44c75b8

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

proposals/devcontainer-templates-distribution.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ Each sub-directory should be named such that it matches the `id` field of the `d
5050

5151
## Versioning
5252

53-
Each Template is published with only the `latest` tag. Tooling that handles releasing Templates will republish the `latest` tag every time a new release is created.
53+
Each Template is individually [versioned according to the semver specification](https://semver.org/). The `version` property in the respective `devcontainer-template.json` file is parsed to determine if the Template should be republished.
54+
55+
Tooling that handles publishing Templates will not republish Templates if that exact version has already been published; however, tooling must republish major and minor versions in accordance with the semver specification.
5456

5557
## Packaging
5658

@@ -81,27 +83,30 @@ A user can add a Template in to their projects as defined by the [supporting Too
8183

8284
An OCI registry that implements the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec) serves as the primary distribution mechanism for Templates.
8385

84-
Each packaged Template is pushed to the registry following the naming convention `<registry>/<namespace>/<id>[:latest]`.
86+
Each packaged Template is pushed to the registry following the naming convention `<registry>/<namespace>/<id>[:version]`, where version is the major, minor, and patch version of the Template, according to the semver specification.
8587

8688
> **Note:** The `namespace` is a unique identifier for the collection of Templates and must be different than the collection of [Features](./devcontainer-features.md). There are no strict rules for the `namespace`; however, one pattern is to set `namespace` equal to source repository's `<owner>/<repo>`.
8789
8890
A custom media type `application/vnd.devcontainers` and `application/vnd.devcontainers.layer.v1+tar` are used as demonstrated below.
8991

90-
For example, the `go` Template in the `devcontainers/templates` namespace would be pushed to the ghcr.io OCI registry with the `latest` tag.
92+
For example, the `go` Template in the `devcontainers/templates` namespace at version `1.2.3` would be pushed to the ghcr.io OCI registry.
9193

9294
> **Note:** The example below uses [`oras`](https://oras.land/) for demonstration purposes. A supporting tool should directly implement the required functionality from the aforementioned OCI artifact distribution specification.
9395
9496
```bash
95-
# ghcr.io/devcontainers/templates/go:latest
97+
# ghcr.io/devcontainers/templates/go:1
9698
REGISTRY=ghcr.io
9799
NAMESPACE=devcontainers/templates
98100
TEMPLATE=go
99101

100102
ARTIFACT_PATH=devcontainer-template-go.tgz
101103

102-
oras push ${REGISTRY}/${NAMESPACE}/${TEMPLATE}:latest \
103-
--manifest-config /dev/null:application/vnd.devcontainers \
104-
./${ARTIFACT_PATH}:application/vnd.devcontainers.layer.v1+tar
104+
for VERSION in 1 1.2 1.2.3 latest
105+
do
106+
oras push ${REGISTRY}/${NAMESPACE}/${TEMPLATE}:${VERSION} \
107+
--manifest-config /dev/null:application/vnd.devcontainers \
108+
./${ARTIFACT_PATH}:application/vnd.devcontainers.layer.v1+tar
109+
done
105110

106111
```
107112

proposals/devcontainer-templates.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,19 @@ The `options` property contains a map of option IDs and their related configurat
6868
6969
### Referencing a Template
7070

71-
The `id` format (`<oci-registry>/<namespace>/<template>[:latest]`) dictates how a [supporting tool](../docs/specs/supporting-tools.md#supporting-tools-and-services) will locate and download a given Template from an OCI registry (For example - `ghcr.io/user/repo/go:latest`). The registry must implement the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec). Some implementors can be [found here](https://oras.land/implementors/).
71+
The `id` format (`<oci-registry>/<namespace>/<template>[:<semantic-version>]`) dictates how a [supporting tool](https://containers.dev/supporting) will locate and download a given Template from an OCI registry. For example:
72+
73+
- `ghcr.io/user/repo/go`
74+
- `ghcr.io/user/repo/go:1`
75+
- `ghcr.io/user/repo/go:latest`
76+
77+
The registry must implement the [OCI Artifact Distribution Specification](https://github.com/opencontainers/distribution-spec). Some implementors can be [found here](https://oras.land/implementors/).
7278

7379
## Versioning
7480

75-
Each Template is published with only the `latest` tag. Tooling that handles releasing Templates will republish the `latest` tag every time a new release is created.
81+
Each Template is individually [versioned according to the semver specification](https://semver.org/). The `version` property in the respective `devcontainer-template.json` file is updated to increment the Template's version.
82+
83+
Tooling that handles releasing Templates will not republish Templates if that exact version has already been published; however, tooling must republish major and minor versions in accordance with the semver specification.
7684

7785
## Release
7886

0 commit comments

Comments
 (0)