Fix dev container build failing on restricted networks - #101
Conversation
The dev container failed to build because the Node.js feature installs pnpm from the public npm registry, which is unreachable on networks that enforce an internal package feed proxy. Node.js existed only to run `npm install -g changie`. Nothing in this repository is JavaScript, so the feature is removed and changie is installed from its GitHub release as a pinned, checksum-verified binary. Two pre-existing bugs in the postCreate script surfaced once the build got far enough to run it: * The script called `apt-get` without sudo, but postCreateCommand runs as the non-root `vscode` user, so it failed with "Permission denied" and aborted before pip ever ran. * The base image ships an apt source for yarn whose signing key is no longer valid, making every `apt-get update` exit 100. Nothing uses yarn, so the broken source is removed rather than masked. Also forwards PIP_INDEX_URL and PIP_EXTRA_INDEX_URL from the host, since container builds do not inherit host pip configuration. Both resolve to an empty value when unset, which leaves pip on its default index. Co-authored-by: Copilot App <[email protected]>
|
Closing in favour of #97, which solves this more completely. Recording why, since the reasoning is the useful part. This PR does not actually fix the reported bug. It relied on: "remoteEnv": { "PIP_INDEX_URL": "${localEnv:PIP_INDEX_URL}" }That passthrough is a no-op on the affected machines, because the internal mirror is configured in a pip config file, not an environment variable: So My earlier end-to-end run passed only because I had manually exported #97 uses a git-ignored #97 is also ahead on several other points: The one thing this PR did better was pinning per-arch SHA256 constants rather than trusting No code carried over. The docs gap I found while verifying #97 is fixed there directly in |
Problem
The dev container fails to build. The
ghcr.io/devcontainers/features/node:2feature dies withECONNRESETwhile installing pnpm:Root cause
Networks that enforce an internal package feed proxy block the public artifact CDNs. Probing from inside the container:
registry.npmjs.orgfiles.pythonhosted.orgpypi.org/simple/github.comrelease assetsdeb.debian.orgThe host's
~/.npmrcand pip config point at an internal proxy, but those files are not visible insidedocker buildx build, so tooling in the container falls back to the blocked public registries.Note the PyPI index is reachable while the file CDN is not — probing only
pypi.orggives a false all-clear.Changes
1. Remove the Node.js feature. Node existed solely to run
npm install -g changie. Nothing in this repository is JavaScript — there is nopackage.jsonand no JS source. The feature pulled in nvm, yarn, and pnpm to install one Go binary.2. Install changie from its GitHub release. changie ships standalone binaries. Now downloaded at a pinned version with a hardcoded per-arch SHA256, verified before install. This removes the npm registry from the critical path entirely.
Made non-fatal with a loud warning: the container is fully usable for Python development without changie, and hard-failing
postCreateover an optional authoring tool is worse UX.3. Fix
apt-getrunning without sudo (pre-existing bug).postCreateCommandruns as the non-rootvscodeuser, soapt-get updatefailed withPermission deniedandset -eaborted the script before pip ever ran. This has been broken for everyone since e70ab4c — it was masked because the build never got far enough to runpostCreate.4. Remove the stale yarn apt source (pre-existing bug). The base image ships
/etc/apt/sources.list.d/yarn.listwith an expired signing key, so everyapt-get updateexits 100 withNO_PUBKEY 62D54FD4003F6525. Removed rather than masked with|| true, so manualapt-getlater in the container's life also works.5. Forward
PIP_INDEX_URL/PIP_EXTRA_INDEX_URLfrom the host. Vendor-neutral and opt-in — verified these resolve to an empty string when unset, and that pip treats an empty value as its default index. No behavior change for contributors who don't set them.Deliberately not done
No internal feed URLs are hardcoded. This is a public repository; baking in
packagefeedproxy.microsoft.iowould break external contributors and leak internal infrastructure. The fix is to remove unnecessary public-registry dependencies, not to reconfigure feeds.Verification
Ran the real
devcontainer upend-to-end (@devcontainers/cli0.88.0, macOS arm64):{"outcome":"success","remoteUser":"vscode"}Inside the resulting container:
Config also validated with the env vars unset, confirming the external-contributor path resolves cleanly.
Follow-up (not in this PR)
.github/workflows/changelog-existence.ymlstill doesnpm i -g changie. That works on GitHub-hosted runners, but is inconsistent with this change and would break on a self-hosted runner behind a feed proxy. Left alone to keep this PR surgical.Notes
AGENTS.mdrequires- Resolves #<issue>; please add one if this is retargeted atmicrosoft/fabric-cli..changes/unreleased/.