Fix dev container build failure caused by npm registry dependency - #102
Fix dev container build failure caused by npm registry dependency#102ayeshurun wants to merge 1 commit into
Conversation
The dev container build fails during the Node.js feature install when registry.npmjs.org is unreachable (npm ECONNRESET / "Client network socket disconnected before secure TLS connection was established"), which is common behind corporate proxies. Two separate steps depended on that registry: 1. The node feature installs pnpm by default via `npm install -g pnpm`. pnpm is not used by this repository, so it is now disabled with `pnpmVersion: none`. 2. `postCreateCommand` ran `npm install -g changie`, which would fail the same way even after the image built. changie ships as a single Go binary, so it is now downloaded directly from its GitHub release and verified against the published SHA256 checksum. Together these remove all npm registry access from the dev container setup. Also make `sudo` usage conditional in the setup script so it works whether lifecycle scripts run as root or as the `vscode` remote user, since installing into /usr/local/bin requires elevated permissions in the latter case. Verified in mcr.microsoft.com/devcontainers/python:1-3.12-bullseye on both linux/arm64 and linux/amd64, as root and as `vscode`, including checksum verification, loud failure on a bad download, and `changie` correctly parsing this repository's .changie.yaml. Co-authored-by: Copilot App <[email protected]>
|
Closing in favour of #97. Three PRs (#97, #101, #102) were opened for this same bug; consolidating on #97. The diagnosis here is sound and 1. This branch keeps 2. Also worth noting: keeping the The changie install here is close to #97's (pinned version, I rebuilt #97 end-to-end on the affected network with no One gap this PR has independently of the above: no |
Problem
The dev container fails to build during the Node.js feature install:
Root cause
registry.npmjs.orgis unreachable, while every other endpoint in the same build succeeded (nodejs.org,ghcr.io,mcr.microsoft.com). Reproduced outside the container:This is a network-level block on npm (typical of corporate TLS-inspection proxies), not a transient outage — retrying does not help.
Two independent steps depended on that registry:
nodefeature installs pnpm by default (npm install -g pnpm). This is the step that fails the image build. pnpm is not used anywhere in this repository.postCreateCommandrunsnpm install -g changie. This would fail the same way even after the image built, so fixing only (1) would have moved the failure rather than resolved it.Changes
.devcontainer/devcontainer.json— set"pnpmVersion": "none"on the node feature. Confirmed against the feature'sinstall.shthatnoneis explicitly handled (Ignoring installation of PNPM), so this is a real no-op rather than a silently ignored option. With pnpm skipped, the feature makes no npm registry calls at all (node comes fromnodejs.org, yarn is already in the base image,npmVersionalready defaults tonone).scripts/install_dev_container_dependencies.sh— replacenpm install -g changiewith a direct GitHub release download:amd64/arm64)checksums.txt, using an exact filename match so a substring collision cannot select the wrong digestcurl --retry, and fails loudly rather than silently continuingsudois now applied conditionally, because installing into/usr/local/binrequires elevation if lifecycle scripts run as thevscoderemote user rather than rootNet effect: the dev container setup no longer touches the npm registry at any point.
Validation
Run against the actual base image
mcr.microsoft.com/devcontainers/python:1-3.12-bullseye:linux/arm64,vscodeuserchangie version v1.26.0linux/arm64, rootchangie version v1.26.0linux/amd64,vscodeuserchangie version v1.26.0changie latest/changie next patchagainst this repo's.changie.yamlv1.7.0/v1.7.1Also confirmed the base image ships nvm and yarn but no node binary, so the feature is genuinely performing the install (the image's
devcontainer.metadatalabel claiming a node feature is misleading).Trade-offs and open points
Flagging these explicitly rather than burying them:
changieis now pinned to1.26.0, wherenpm i -g changiepreviously resolved tolatest. This gains reproducibility but will go stale and needs deliberate bumping.changiepackage andminiscruff/changieGitHub releases share a version stream, because npm is unreachable from this machine. The installed binary works correctly against this repo's config, but the resolved version may differ from what contributors got previously.skip-changeloglabel; the🔄 Changelogcheck will otherwise fail.github.comrelease assets will still fail — though that was verified reachable here.