ci: enforce devcontainer lockfile integrity - #1062
Merged
Merged
Conversation
## Spec requirement
The devcontainer spec/reference CLI (`@devcontainers/cli`) supports a committed
`devcontainer-lock.json` to pin feature digests for reproducible builds, and exposes
`--frozen-lockfile` to *enforce* an existing lockfile: the build fails if the lockfile
is missing or its resolved digests no longer match the features declared in
`devcontainer.json` (lock drift).
## Gap found
The repo commits `.devcontainer/devcontainer-lock.json` (4 pinned features: go-task,
prek, uv, node) for reproducibility, but the `Devcontainer` workflow
(`.github/workflows/devcontainer.yml`) only builds + runs the devcontainer via
`devcontainers/ci`. It never verifies the committed lockfile, so a stale/incorrect
lockfile would pass CI silently. The reference `devcontainers/ci` action exposes no
frozen-lockfile input, so enforcement must be a dedicated step.
## Change
Add a `Verify feature lockfile integrity` step to the `Devcontainer` workflow that:
1. Installs `@devcontainers/cli`.
2. Runs `devcontainer build --workspace-folder . --image-name devsy-lock-verify:tmp --frozen-lockfile`.
If the committed lockfile is out of sync with the declared features, the frozen build
fails and the job goes red. No feature versions are bumped; no SHA is changed. The
existing `devcontainers/ci` build/run step is unchanged.
## Verification performed
- `task cli:format` — clean (no Go changes).
- `task cli:lint:ci` — 0 new issues (`--new-from-patch`).
- `task cli:test` — pass; only the documented pre-existing `pkg/git` (`TestRepoClone*`)
failure on origin/main, unrelated to this change (workflow YAML only).
- `task cli:test:e2e:suite -- "devcontainer"` — pass (0 devcontainer-labelled specs, no failures).
- **Positive control**: `devcontainer build --workspace-folder . --image-name dc-lock-verify:tmp --frozen-lockfile`
against the current committed lockfile → `{"outcome":"success"}`, exit 0.
- **Negative control**: corrupting the `uv` feature digest in the lockfile and rerunning
the frozen build → exit 1 (`could not be processed`), confirming the step catches drift.
The lockfile was restored to its committed state afterward (no diff).
## Expected impact
Lock drift introduced by a feature version bump without `devcontainer-lock.json`
regeneration is now caught in CI before merge, keeping reproducible devcontainer builds
trustworthy.
This PR was created by an AI agent as part of an automated daily devcontainer spec job.
✅ Deploy Preview for images-devsy-sh ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for devsydev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Up to standards ✅🟢 Issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec requirement
The devcontainer spec/reference CLI (
@devcontainers/cli) supports a committeddevcontainer-lock.jsonto pin feature digests for reproducible builds, and exposes--frozen-lockfileto enforce an existing lockfile: the build fails if the lockfileis missing or its resolved digests no longer match the features declared in
devcontainer.json(lock drift).Gap found
The repo commits
.devcontainer/devcontainer-lock.json(4 pinned features: go-task,prek, uv, node) for reproducibility, but the
Devcontainerworkflow(
.github/workflows/devcontainer.yml) only builds + runs the devcontainer viadevcontainers/ci. It never verifies the committed lockfile, so a stale/incorrectlockfile would pass CI silently. The reference
devcontainers/ciaction exposes nofrozen-lockfile input, so enforcement must be a dedicated step.
Change
Add a
Verify feature lockfile integritystep to theDevcontainerworkflow that:@devcontainers/cli.devcontainer build --workspace-folder . --image-name devsy-lock-verify:tmp --frozen-lockfile.If the committed lockfile is out of sync with the declared features, the frozen build
fails and the job goes red. No feature versions are bumped; no SHA is changed. The
existing
devcontainers/cibuild/run step is unchanged.Verification performed
task cli:format— clean (no Go changes).task cli:lint:ci— 0 new issues (--new-from-patch).task cli:test— pass; only the documented pre-existingpkg/git(TestRepoClone*)failure on origin/main, unrelated to this change (workflow YAML only).
task cli:test:e2e:suite -- "devcontainer"— pass (0 devcontainer-labelled specs, no failures).devcontainer build --workspace-folder . --image-name dc-lock-verify:tmp --frozen-lockfileagainst the current committed lockfile →
{"outcome":"success"}, exit 0.uvfeature digest in the lockfile and rerunningthe frozen build → exit 1 (
could not be processed), confirming the step catches drift.The lockfile was restored to its committed state afterward (no diff).
Expected impact
Lock drift introduced by a feature version bump without
devcontainer-lock.jsonregeneration is now caught in CI before merge, keeping reproducible devcontainer builds
trustworthy.
This PR was created by an AI agent as part of an automated daily devcontainer spec job.