From 5a7ac0fd0421989236360511e648a8d4b1a938ff Mon Sep 17 00:00:00 2001 From: Riccardo Tacconi Date: Tue, 17 Nov 2026 18:10:35 +0000 Subject: [PATCH 1/4] fix(release): query default store in enterprise-prebuilt A bare --store /nix/store is treated as a chroot root, so path-info tried to create /nix/store/nix/store and aborted the prebuilt step. --- scripts/enterprise-prebuilt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/enterprise-prebuilt.sh b/scripts/enterprise-prebuilt.sh index de2d0ea..c718e5c 100755 --- a/scripts/enterprise-prebuilt.sh +++ b/scripts/enterprise-prebuilt.sh @@ -56,7 +56,9 @@ nix build ".#nixosConfigurations.kcore-controller-node.config.system.build.tople echo "==> Collecting closure paths not on cache.nixos.org..." : >"${WORK}/paths.txt" for link in node controller; do - nix path-info -r --store /nix/store "$(readlink -f "${WORK}/${link}")" >>"${WORK}/all-paths.txt" + # Do not pass --store /nix/store: a bare path is a chroot store root, so + # Nix would look under /nix/store/nix/store and fail on the read-only FS. + nix path-info -r "$(readlink -f "${WORK}/${link}")" >>"${WORK}/all-paths.txt" done sort -u "${WORK}/all-paths.txt" -o "${WORK}/all-paths.txt" From b82b271ddd5494aceca9507e94c77f901a87a4e1 Mon Sep 17 00:00:00 2001 From: Riccardo Tacconi Date: Tue, 17 Nov 2026 18:44:13 +0000 Subject: [PATCH 2/4] fix(release): export real flake packages in enterprise prebuilt Fixture nixosConfigurations use hello placeholders, so their closures never contained kctl or the agents. Build and cache the packages a host update substitutes, and rehearse against those. --- docs/enterprise-channel.md | 7 ++++--- scripts/enterprise-prebuilt.sh | 32 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/docs/enterprise-channel.md b/docs/enterprise-channel.md index 6ae5665..2fb9156 100644 --- a/docs/enterprise-channel.md +++ b/docs/enterprise-channel.md @@ -104,9 +104,10 @@ Individual steps: `make release-prebuilt`, `make release-publish-enterprise`, ## Limits -- Prebuilt covers the `kcore-node` and `kcore-controller-node` reference - systems. Features outside them (for example NVIDIA host drivers) still - build on the node. +- Prebuilt covers the flake packages a host update substitutes (`kctl`, + `kcore-node-agent`, `kcore-controller`, `kcore-console`, + `kcore-dashboard`). Features outside them (for example NVIDIA host + drivers) still build on the node. - The first release that ships this code goes to both channels the same day so clusters can update into the new controller and agent. The 14-day lead starts with the release after that. diff --git a/scripts/enterprise-prebuilt.sh b/scripts/enterprise-prebuilt.sh index c718e5c..18917bf 100755 --- a/scripts/enterprise-prebuilt.sh +++ b/scripts/enterprise-prebuilt.sh @@ -46,19 +46,25 @@ rm -rf "${WORK}" mkdir -p "${CACHE}/nar" "${STORE}" "dist/enterprise" printf 'StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 40\n' >"${CACHE}/nix-cache-info" -echo "==> Building reference systems for prebuilt cache..." -nix build ".#nixosConfigurations.kcore-node.config.system.build.toplevel" -o "${WORK}/node" -nix build ".#nixosConfigurations.kcore-controller-node.config.system.build.toplevel" -o "${WORK}/controller" +# Real host flakes pull these packages from the kcore input. The +# nixosConfigurations.kcore-node fixtures use hello placeholders so their +# closures are useless for a binary cache. +packages=(kctl kcore-node-agent kcore-controller kcore-console kcore-dashboard) +echo "==> Building kcore packages for prebuilt cache..." +for attr in "${packages[@]}"; do + nix build ".#${attr}" -o "${WORK}/${attr}" +done # Paths that cache.nixos.org already serves stay out of the enterprise tar. -# Everything else (kcore packages and their local dependents) is signed and +# Everything else (kcore packages and their runtime closure) is signed and # exported into the file cache. echo "==> Collecting closure paths not on cache.nixos.org..." +: >"${WORK}/all-paths.txt" : >"${WORK}/paths.txt" -for link in node controller; do +for attr in "${packages[@]}"; do # Do not pass --store /nix/store: a bare path is a chroot store root, so # Nix would look under /nix/store/nix/store and fail on the read-only FS. - nix path-info -r "$(readlink -f "${WORK}/${link}")" >>"${WORK}/all-paths.txt" + nix path-info -r "$(readlink -f "${WORK}/${attr}")" >>"${WORK}/all-paths.txt" done sort -u "${WORK}/all-paths.txt" -o "${WORK}/all-paths.txt" @@ -92,18 +98,18 @@ fi echo "==> Rehearsing: prebuilt + cache.nixos.org must build kcore packages with --max-jobs 0..." rm -rf "${REHEARSAL_STORE}" mkdir -p "${REHEARSAL_STORE}" -kcore_rev="$(git rev-parse HEAD)" -flake_url="github:kcorehypervisor/kcore/${kcore_rev}" -# Build the packages a node pulls from the kcore flake. --max-jobs 0 refuses -# to compile; a missing path fails the release. -for attr in kctl kcore-node-agent kcore-controller kcore-console kcore-dashboard; do - echo " nix build ${flake_url}#${attr} --max-jobs 0" +# Rehearse against this tree. Day-0 enterprise publish pins the same commit +# on main; customers resolve github:kcorehypervisor/kcore/ to matching +# store paths. +flake_ref="path:${ROOT}" +for attr in "${packages[@]}"; do + echo " nix build ${flake_ref}#${attr} --max-jobs 0" nix build \ --store "${REHEARSAL_STORE}" \ --extra-substituters "file://${CACHE}?trusted=1 https://cache.nixos.org" \ --extra-trusted-public-keys "${PUBLIC_KEY} cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" \ --max-jobs 0 \ - "${flake_url}#${attr}" \ + "${flake_ref}#${attr}" \ -o "${WORK}/rehearsal-${attr}" || die "rehearsal failed for ${attr}: a path would have to compile" done From c969bf25c209cf92ebc5118c6141644136090d4e Mon Sep 17 00:00:00 2001 From: Riccardo Tacconi Date: Tue, 17 Nov 2026 18:44:37 +0000 Subject: [PATCH 3/4] fix(release): keep enterprise rehearsal store out of the tree Exclude dist/ from the pre-commit nixfmt walk and put the chroot store under TMPDIR so a failed rehearsal cannot block the next commit. --- scripts/enterprise-prebuilt.sh | 8 ++++++-- scripts/hooks/pre-commit | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/enterprise-prebuilt.sh b/scripts/enterprise-prebuilt.sh index 18917bf..39d68bd 100755 --- a/scripts/enterprise-prebuilt.sh +++ b/scripts/enterprise-prebuilt.sh @@ -18,7 +18,8 @@ PREBUILT_NAME="kcore-prebuilt-${VERSION}-x86_64-linux.tar" WORK="${ROOT}/dist/enterprise-work" CACHE="${WORK}/cache" STORE="${WORK}/store" -REHEARSAL_STORE="${WORK}/rehearsal-store" +# Keep the chroot store out of the repo so pre-commit nixfmt does not scan it. +REHEARSAL_STORE="${TMPDIR:-/tmp}/kcore-enterprise-rehearsal-$$" MAX_ASSET_BYTES=$((2 * 1024 * 1024 * 1024)) # GitHub release asset limit die() { @@ -96,7 +97,10 @@ if ((asset_size > MAX_ASSET_BYTES)); then fi echo "==> Rehearsing: prebuilt + cache.nixos.org must build kcore packages with --max-jobs 0..." -rm -rf "${REHEARSAL_STORE}" +cleanup_rehearsal() { + rm -rf "${REHEARSAL_STORE}" +} +trap cleanup_rehearsal EXIT mkdir -p "${REHEARSAL_STORE}" # Rehearse against this tree. Day-0 enterprise publish pins the same commit # on main; customers resolve github:kcorehypervisor/kcore/ to matching diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit index f90243d..d39e2cc 100755 --- a/scripts/hooks/pre-commit +++ b/scripts/hooks/pre-commit @@ -14,7 +14,7 @@ cargo fmt --check || { } echo "pre-commit: checking Nix formatting..." -find . -name '*.nix' -not -path './result*' -exec nixfmt --check {} + || { +find . -name '*.nix' -not -path './result*' -not -path './dist/*' -not -path './target/*' -exec nixfmt --check {} + || { echo "" echo " Nix formatting check failed. Run 'make fmt' to fix." exit 1 From 25edce180eeed91a779d3f74d8e2dbe7b001b6d2 Mon Sep 17 00:00:00 2001 From: Riccardo Tacconi Date: Tue, 17 Nov 2026 19:07:40 +0000 Subject: [PATCH 4/4] fix(release): build enterprise prebuilt from the pushed commit Local dirty trees change crane source hashes; building from github:kcorehypervisor/kcore/ keeps cache paths aligned with customer installs and rehearsal. --- scripts/enterprise-prebuilt.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/enterprise-prebuilt.sh b/scripts/enterprise-prebuilt.sh index 39d68bd..3b19e03 100755 --- a/scripts/enterprise-prebuilt.sh +++ b/scripts/enterprise-prebuilt.sh @@ -50,10 +50,15 @@ printf 'StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 40\n' >"${CACHE}/nix-c # Real host flakes pull these packages from the kcore input. The # nixosConfigurations.kcore-node fixtures use hello placeholders so their # closures are useless for a binary cache. +# +# Build from the pushed commit so store paths match customer installs and +# a dirty worktree cannot change the source filter hash. packages=(kctl kcore-node-agent kcore-controller kcore-console kcore-dashboard) -echo "==> Building kcore packages for prebuilt cache..." +kcore_rev="$(git rev-parse HEAD)" +flake_ref="github:kcorehypervisor/kcore/${kcore_rev}" +echo "==> Building kcore packages for prebuilt cache from ${flake_ref}..." for attr in "${packages[@]}"; do - nix build ".#${attr}" -o "${WORK}/${attr}" + nix build "${flake_ref}#${attr}" -o "${WORK}/${attr}" done # Paths that cache.nixos.org already serves stay out of the enterprise tar. @@ -98,14 +103,12 @@ fi echo "==> Rehearsing: prebuilt + cache.nixos.org must build kcore packages with --max-jobs 0..." cleanup_rehearsal() { + # Nix store paths are read-only; chmod before rm. + chmod -R u+w "${REHEARSAL_STORE}" 2>/dev/null || true rm -rf "${REHEARSAL_STORE}" } trap cleanup_rehearsal EXIT mkdir -p "${REHEARSAL_STORE}" -# Rehearse against this tree. Day-0 enterprise publish pins the same commit -# on main; customers resolve github:kcorehypervisor/kcore/ to matching -# store paths. -flake_ref="path:${ROOT}" for attr in "${packages[@]}"; do echo " nix build ${flake_ref}#${attr} --max-jobs 0" nix build \