build: make Go and Python builds fully offline (hermetic Nix build)
The Nix build previously fetched Go modules from goproxy.cn and Python build deps from PyPI during the build phase, relying on network leaking into the sandbox. This is non-reproducible and breaks whenever the sandbox resolver is unreachable (e.g. pc13v's loopback dnsmasq). Go: - Vendor all three modules (frontend/apiserver, frontend/xcecli, autoscaler/providers/baidu/src/bcctool) and commit vendor/ trees. - tools/go_build now builds with GOFLAGS=-mod=vendor and GOPROXY=off instead of GOPROXY=https://goproxy.cn. Python (xceadmin): - Add setuptools + wheel to xce.nix nativeBuildInputs. - meson-build.sh installs with pip --no-build-isolation --no-index --no-deps so no PyPI access happens at build time. xceadmin install script: - Invoke meson-install.sh via find_program('bash') instead of relying on its #!/usr/bin/env bash shebang, which fails in the Nix install sandbox (no /usr/bin/env -> 'could not be run'). Cleanup: - Drop now-unneeded cacert and impureEnvVars=[HOME] from xce.nix and xcecli.nix (they only existed to enable the impure network fetch). Docs: - README build guide: drop '--option sandbox false' from nix build / nix bundle commands, note the build is now hermetic, and document the go mod vendor + git add vendor/ maintenance workflow. Verified: nix build .#xcecore, .#xcecore_debug, .#xcecli, and .#xce all succeed with the sandbox enabled.
This commit is contained in:
parent
a51790dcbb
commit
68bc86bc59
3333 changed files with 1438798 additions and 11 deletions
|
|
@ -97,7 +97,12 @@ for _n in $FIX_ENVARS; do
|
|||
fix_env $_n $ENVARS;
|
||||
done
|
||||
|
||||
export GOPROXY=https://goproxy.cn
|
||||
# Build fully offline from the committed vendor/ tree in each module. This
|
||||
# keeps the Go build hermetic inside the Nix sandbox (no network, no DNS) --
|
||||
# see tools/go_build history / nixSupport notes. Run `go mod vendor` in the
|
||||
# affected module (via `nix develop`) and commit vendor/ when deps change.
|
||||
export GOFLAGS="-mod=vendor"
|
||||
export GOPROXY=off
|
||||
|
||||
_git_commit="$XCE_GIT_COMMIT"
|
||||
_build_time="$XCE_BUILD_TIME"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue