Repository navigation
fix: stop shipping the 4 GB package repository in every image (#128) - #156
Conversation
…tbluefin#128) The live ISO grew from 7.7G (2026-09-06, last passing run) to 8.6G (2026-09-18) between builds. Root cause: the Containerfile copied the digest-pinned `packages` stage's RPM repository into a layer with `COPY --from=packages /repository /etc/utah-packages`, and nothing ever removed it. That ~4 GB is two thirds of every published image and of every live ISO, whose squashfs holds the whole mounted image. Bind the repository into the two RUN steps that install from it with a BuildKit `RUN --mount=type=bind,from=packages`, so it costs no layer and leaves nothing on disk. Reproducibility still comes from the digest-pinned `packages` stage, the only source the package transaction sees. The flavor step flips `utah-packages.repo` to enabled=0 last, so later dnf calls on the image (the live ISO build's included) do not fail on a file:// baseurl that no longer exists. Add a size budget to iso/scripts/build-iso.sh that fails closed above ISO_MAX_GB (override UTAH_ISO_MAX_GB) once the ISO is written, so drift stops landing silently. Raise N only after projectbluefin#105 (linux-firmware + parity packages) is evaluated. just check asserts the mount and refuses a `COPY --from=packages`. Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
5131d69 to
8db7766
Compare
There was a problem hiding this comment.
Correctness review (read at head 8db7766 — the SHA I was dispatched with, 5131d69, has been superseded).
High — the ISO budget guard makes every ISO build fail, not just oversized ones. The guard block (iso/scripts/build-iso.sh:176-181) sits inside the <<'ASSEMBLY' quoted heredoc that is executed by a separate process, podman unshare bash -s (line 60). ISO_MAX_GB is assigned in the outer script (line 23) but never exported, and the quoted heredoc suppresses outer expansion — so inside the assembly shell, which runs set -euo pipefail (line 61), line 176 iso_max_bytes=$(( ISO_MAX_GB * 1024 * 1024 * 1024 )) dies with ISO_MAX_GB: unbound variable. Verified: ISO_MAX_GB=8 bash -s <<'EOF' ... set -u; $((ISO_MAX_GB*1024)) ... EOF → exit 1, unbound variable. Every run fails after the ISO is written, and the UTAH_ISO_MAX_GB override never reaches the guard either. Fix: pass ISO_MAX_GB as an eighth positional arg alongside the existing seven (line 60/62-68), or export it.
Medium — the new test masks exactly this bug. tests/test_iso_ci.py:100-119 extracts only the guard block and then re-defines ISO_MAX_GB=${ISO_MAX_GB:-8} in its own harness before running it, so the test passes while the real script cannot. A test that ran the guard in a context matching the ASSEMBLY heredoc (unset var + set -u) would have caught it; at minimum the harness should not inject the variable the script under test is responsible for providing.
Minor: sed -i 's/^enabled=1$/enabled=0/' (Containerfile:204) flips every enabled=1 line in utah-packages.repo; fine if the file has a single section, but a section-anchored match would be safer if one is ever added.
The Containerfile mount conversion itself (Containerfile:120-121, 189-190) and the just check assertions (Justfile:67-70) look correct for the stated goal.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
There was a problem hiding this comment.
Correctness review (head 8db7766)
High — the new budget guard makes every ISO build fail, even under budget. The guard added at the bottom of iso/scripts/build-iso.sh (lines 173–181) runs inside the <<'ASSEMBLY' quoted heredoc executed by podman unshare bash -s (line 60). That inner bash runs set -euo pipefail (line 61) and receives only the 7 positional args (lines 62–68); ISO_MAX_GB is a plain, unexported assignment in the outer script (line 23), so it is not in the inner shell's environment. The first guard line, iso_max_bytes=$(( ISO_MAX_GB * 1024 * 1024 * 1024 )), therefore dies with ISO_MAX_GB: unbound variable on every run — after xorriso has already written the ISO — so the build exits 1 regardless of size, and the UTAH_ISO_MAX_GB override can never work either. Reproduced:
$ bash -c 'set -u; ISO_MAX_GB=8; bash -s <<'\''H'\''
set -euo pipefail
echo $(( ISO_MAX_GB * 1024 ))
H'
bash: line 2: ISO_MAX_GB: unbound variable
Fix: pass ISO_MAX_GB as an 8th positional arg alongside the others on line 60 (or export ISO_MAX_GB before the heredoc).
Medium — the new test cannot catch this. tests/test_iso_ci.py::test_iso_budget_guard_fails_closed_above_ceiling extracts the guard block and re-runs it with ISO_MAX_GB injected by the test harness itself ("ISO_MAX_GB=${ISO_MAX_GB:-8}; ..."), so it validates the arithmetic but masks exactly the variable-scoping failure above. After fixing the plumbing, consider asserting the variable is actually delivered into the heredoc (e.g., grep for it in the podman unshare bash -s -- arg list).
The Containerfile change itself looks correct: both installing RUN steps get the mount (Containerfile:120, 189), no intermediate RUN touches the repo while enabled=1 with the baseurl absent, and the sed disable (Containerfile:205) matches the literal enabled=1 in packages/utah-packages.repo.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
The budget guard (projectbluefin#128) lived inside the <<'ASSEMBLY' quoted heredoc, which runs under 'podman unshare bash -s' in a separate set -u shell that only received the seven positional args. ISO_MAX_GB was a plain, unexported assignment in the outer script, so the guard died with 'ISO_MAX_GB: unbound variable' on every build -- after the ISO was already written -- and the UTAH_ISO_MAX_GB override never reached it either. Pass ISO_MAX_GB as an eighth positional arg alongside the others. Update the budget guard test, which injected ISO_MAX_GB itself and thus masked exactly this scoping failure, to stop injecting it and to assert the variable is actually delivered into the heredoc arg list. Fixes review feedback (projectbluefin#156).
|
Thanks for the review -- this was a real bug and both findings pointed at the same root cause. High (plumbing): Medium (test): the budget guard test injected The minor
|
There was a problem hiding this comment.
Reviewed for correctness (head d43e4e1). Verified locally: tests/test_iso_ci.py passes (11/11), bash -n iso/scripts/build-iso.sh OK, the Justfile grep assertions hold, and the traced dnf call sites are consistent with the fix — installs happen inside the two mounted RUNs (Containerfile:120, :189) while the repo is still enabled, and the only post-disable dnf call (iso/live/Containerfile:21) is covered by the enabled=0 flip at Containerfile:206.
Two low-severity notes, neither blocking:
-
Silent-no-op risk in the sed flip (Containerfile:206):
sed -i 's/^enabled=1$/enabled=0/'matches today's packages/utah-packages.repo:7, but if that file's formatting ever changes (e.g.enabled = 1), the sed no-ops silently and the live-ISO dnf call fails later with a confusing missing-file://-baseurl error. Agrep -q '^enabled=0$' …assertion after the sed would fail fast at the right place. -
Test relies on bash's unset-PATH fallback (tests/test_iso_ci.py:120-125): the guard test runs
bash -eu -cwith an env containing onlyISO_MAX_GB/DU_BYTES/DU_HUMAN— noPATH— yet the extracted guard pipes throughcut(iso/scripts/build-iso.sh:178). It works because bash falls back to a compiled-in default PATH, but that's implementation-defined; passingPATHthrough in the test env would make it robust.
Limit of this review: I could not run the actual image build (no podman here); the RUN --mount=type=bind,from=… behavior is verified by inspection only and will be exercised by the PR's own CI build.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
…a PATH - Containerfile: assert enabled=0 actually took after the sed so a formatting change can't silently leave the repo enabled and break a later dnf call on a missing file:// baseurl. - test_iso_ci: pass PATH into the budget-guard harness so it no longer relies on bash's unset-PATH fallback for the cut pipe.
|
Addressed the two low-severity notes from the last review:
Both existing budget-guard assertions still pass.🐝 Hive Agent: |
#128: live ISO grew 7.7G -> 8.6G between the last passing runs
Root cause
The live ISO grew from 7.7G (2026-09-06, last passing run) to 8.6G
(2026-09-18) because the Containerfile copied the digest-pinned
packagesstage's RPM repository into a layer that nothing ever removed:
That ~4 GB is two thirds of every published image and of every live ISO,
whose squashfs holds the whole mounted image. It is not a package bump -- it is
the same ~4 GB repository, now committed to the image instead of just mounted
for the install transaction.
Fix
Bind the repository into the two
RUNsteps that install from it with aBuildKit mount, so it costs no layer and leaves nothing on disk:
Reproducibility is unchanged: the
packagesstage is still digest-pinned andis the only source the package transaction sees -- that is what the old
comment meant by "does not depend on a mutable Pages mirror." The flavor step
now flips
utah-packages.repotoenabled=0last, so laterdnfcalls on theimage (the live ISO build's included) do not fail on a
file://baseurl thatno longer exists.
Guard added
iso/scripts/build-iso.shnow fails closed aboveISO_MAX_GB(override perrun with
UTAH_ISO_MAX_GB) once the ISO is written, comparing byte counts sothe GB ceiling is exact. This is the explicit guard the issue asks for: drift
stops landing silently. The ceiling is 8 GB -- deliberately between the
last passing run (7.7G) and the grown size (8.6G), so the exact #128
regression fails the job instead of landing silently; a ceiling at or above
8.6G would be toothless against it. There is headroom for #105 (linux-firmware
just checknow asserts the mount and refuses anyCOPY --from=packages.Scope
Focused on #128 only. Deliberately not included here (separate issues):
Verification
just checkpasses offline (script syntax, skill front-matter/index,download integrity, the package-repo mount assertions, and a new unit test
that runs the budget guard with
dustubbed). The image build itself couldnot be run in this environment (no podman); the change matches the proven
RUN --mountfix the maintainer team already landed, and the build's firstgate is
just check, which is green. The mount requires BuildKit mode, whichthe upstream
bootc-buildrunner provides.— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K