Skip to content

Commit aa44848

Browse files
authored
Use a pinned devcontainer base image version (#50)
We want to pin to the most specific version we can, to ensure that the devcontainer builds are always reproducible. This is despite the general guidance from Microsoft for these images being to use ["the major release version of this tag to avoid breaking changes while still taking fixes and content additions as they land. e.g. `0-buster`"][1] We will still take fixes and content additions as they land, as we use Dependabot to keep us up to date. Dependabot will create a PR whenever there is a new version of the base image, and we then manually apply that new version to the `devcontainer.json` (full details on how to do this are in the `DEPENDENCIES.md`). See also [this documentation on the base image versions][2] [1]: https://hub.docker.com/_/microsoft-vscode-devcontainers?tab=description [2]: https://github.com/microsoft/vscode-dev-containers/tree/master/containers/debian#using-this-definition-with-an-existing-folder
1 parent 66f4183 commit aa44848

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Based on the example Dockerfile at:
22
# https://github.com/microsoft/vscode-dev-containers/blob/master/containers/debian/.devcontainer/Dockerfile
33

4-
# Update the VARIANT arg in devcontainer.json to pick an Debian version: buster (or debian-10), stretch (or debian-9)
4+
# Update the VARIANT arg in devcontainer.json to override the Debian version below
55
ARG VARIANT=buster
66
FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT}
77

.devcontainer/devcontainer.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"name": "Docker Container GitHub Action development",
3-
"dockerFile": "Dockerfile",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
// Update 'VARIANT' to pick an Debian version: buster, stretch, or a version
6+
// specific tag tied to a release in:
7+
// https://github.com/microsoft/vscode-dev-containers/releases
8+
// See also:
9+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/debian#using-this-definition-with-an-existing-folder
10+
"args": { "VARIANT": "0.123.0-buster" }
11+
},
412

513
// Set *default* container specific settings.json values on container create.
614
"settings": {

.github/DEPENDENCIES.md

+16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ but that would be overkill for now.
2929
Eventually as Dependabot adds more features we may be able to remove this workaround.
3030

3131

32+
## Devcontainer base image version
33+
34+
We always pin to the most specific ([patch-level](https://semver.org/)) version of the [devcontainer Docker base image](https://github.com/microsoft/vscode-dev-containers/tree/master/containers/debian#using-this-definition-with-an-existing-folder) that we can, to ensure that the devcontainer builds are always reproducible.
35+
36+
This is despite the general guidance from Microsoft for these images being to use ["the major release version of this tag to avoid breaking changes while still taking fixes and content additions as they land. e.g. `0-buster`"](https://hub.docker.com/_/microsoft-vscode-devcontainers?tab=description)
37+
38+
The reason we are comfortable pinning to a specific patch-level version is that we still take fixes and content additions as they land, because we use Dependabot to keep us up to date (using the [above workaround](#workaround-for-other-dependencies)).
39+
40+
NB when we manually update the version in the `devcontainer.json`, we need to be careful as the version format is
41+
e.g. `0.123.0-buster`, compared to `v0.123.0` in the [`dependabot_hack.yml`](workflows/dependabot_hack.yml)
42+
43+
When the new version is a patch or minor level update, we don't bother to test manually that the new remote container works (before merging the Dependabot PR). In the (hopefully rare) event that it doesn't, we can simply put in another PR to downgrade the version to one that does work.
44+
45+
For major version updates, we should test that the remote container works successfully before merging the Dependabot PR. The most failsafe way to test this is to [open the Dependabot PR branch in a remote Visual Studio Code container](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume). Alternatively starting a new [Codespace](https://github.com/features/codespaces/) that points to the Dependabot PR branch should also be a valid test.
46+
47+
3248
## Dockerfile dependencies
3349

3450
We have [pinned the linux dependencies in the devcontainer Dockerfile](https://github.com/agilepathway/hoverfly-github-action/pull/46/files), but there is no mechanism to automatically update them, currently. It looks like [it's on Dependabot's roadmap](https://github.com/dependabot/dependabot-core/issues/2129#issuecomment-511552345), so we have reminders every 6 months to

.github/workflows/dependabot_hack.yml

+4
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ jobs:
2828

2929
# update the version in `github_tag_and_release.yml` manually, too
3030
- uses: golang/[email protected]
31+
32+
# update the variant version in the devcontainer.json manually, too
33+
# (see ../DEPENDENCIES.md#devcontainer-base-image-version for more info )
34+
- uses: microsoft/[email protected]

0 commit comments

Comments
 (0)