Skip to content

fix(release): use built minimald when packing initramfs - #623

Merged
twitchyliquid64 merged 2 commits into
mainfrom
tom/release
Jul 3, 2026
Merged

fix(release): use built minimald when packing initramfs#623
twitchyliquid64 merged 2 commits into
mainfrom
tom/release

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 3, 2026

Copy link
Copy Markdown
Member

A naive call to build-initramfs.sh builds minimald to embed it in the initramfs, but we've already built it in a different job. Changes the script + wiring to use the minimald already built for packing in the initramfs.

Summary by CodeRabbit

  • New Features

    • Added support for generating and publishing initramfs artifacts as part of the release process.
    • Release packaging now produces guest components and initramfs images in separate stages for cleaner, more flexible artifact handling.
    • Improved release artifact creation by optionally reusing prebuilt helper binaries when available.
  • Chores

    • Refactored the release workflow to streamline artifact preparation, reduce job duration, and update the release job’s orchestration to reflect the new stages.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release workflow now fetches guest artifacts separately from initramfs generation, and the helper scripts accept prebuilt mip and minimald binaries through environment variables.

Changes

Release initramfs split and binary reuse

Layer / File(s) Summary
build-initramfs.sh prebuilt-binary mode
scripts/build-initramfs.sh
Adds MINIMALD_BIN handling that validates and packs a supplied executable directly, while keeping the existing cargo and toolchain-selection path when unset.
Reuse prebuilt MIP in fetch scripts
scripts/fetch-artifact.sh, scripts/fetch-libkrun.sh
Both scripts now reuse a provided MIP executable when present and otherwise build mip locally.
Trim guest artifact job
.github/workflows/release.yml
Renames the guest artifact job, removes initramfs-related steps and cpio, and updates the job timeout and artifact notes.
Add initramfs build job and wiring
.github/workflows/release.yml
Adds a separate initramfs job, downloads prebuilt minimald binaries, uploads minimald-initramfs-*, updates release dependencies, and sets MIP for libkrun materialization.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • gominimal/minimal#466: Both PRs modify the libkrun acquisition path by changing scripts/fetch-libkrun.sh to work with prebuilt inputs.
  • gominimal/minimal#606: Both PRs refactor GitHub Actions release steps to split artifact build and upload responsibilities.
  • gominimal/minimal#614: Both PRs touch the release build flow around libkrun materialization and prebuilt mip reuse.

Suggested reviewers: norrietaylor, bryan-minimal

Poem

A bunny split the release path neat,
One hop for kernels, one for a treat,
Prebuilt mip and minimald in sight,
Pack the initramfs just right.
🐇🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: reusing a built minimald binary when generating initramfs during release.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
scripts/fetch-artifact.sh (1)

41-49: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Validation only checks executable bit, not regular-file type.

[ -x "$MIP" ] also returns true for an executable/searchable directory. If $MIP is misconfigured to point at a directory, the check passes and the failure only surfaces later at "$MIP" materialize ... with a less clear error. Since MIP is CI-controlled input and the downstream failure is still explicit, this is a minor edge case.

🛡️ Optional tightening
-  [ -x "$MIP" ] || { echo "MIP not an executable file: $MIP" >&2; exit 1; }
+  [ -f "$MIP" ] && [ -x "$MIP" ] || { echo "MIP not an executable file: $MIP" >&2; exit 1; }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fetch-artifact.sh` around lines 41 - 49, The MIP validation in
fetch-artifact.sh only checks executability, so a directory can still pass and
fail later in the materialize step. Tighten the existing MIP branch by
validating that $MIP is a regular executable file before using it, keeping the
check near the current [ -x "$MIP" ] guard and preserving the same fallback
build-from-source path when MIP is unset.
scripts/fetch-libkrun.sh (1)

44-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated MIP-resolution logic across both fetch scripts.

This block (comment + conditional) is identical to the one in scripts/fetch-artifact.sh (lines 41-49). Consider extracting a small shared helper (e.g. scripts/lib/resolve-mip.sh, sourced by both) to avoid drift if the fallback/validation logic changes later.

♻️ Example extraction
# scripts/lib/resolve-mip.sh
resolve_mip() {
  if [ -n "${MIP:-}" ]; then
    [ -x "$MIP" ] || { echo "MIP not an executable file: $MIP" >&2; exit 1; }
  else
    cargo build -p mip
    MIP="$ROOT/target/debug/mip"
  fi
}

Then in each script:

-if [ -n "${MIP:-}" ]; then
-  [ -x "$MIP" ] || { echo "MIP not an executable file: $MIP" >&2; exit 1; }
-else
-  cargo build -p mip
-  MIP="$ROOT/target/debug/mip"
-fi
+. "$ROOT/scripts/lib/resolve-mip.sh"
+resolve_mip

Same -x vs -f note as flagged in fetch-artifact.sh also applies here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fetch-libkrun.sh` around lines 44 - 52, The MIP resolution block in
fetch-libkrun.sh duplicates the same fallback/validation logic used by
fetch-artifact.sh, so extract it into a shared helper such as resolve_mip in a
sourced script under scripts/lib and have both scripts call that helper instead.
While refactoring, keep the existing executable check in the MIP branch (the
same -x validation used in the current MIP handling) so the behavior stays
consistent and doesn’t drift between the two scripts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/fetch-artifact.sh`:
- Around line 41-49: The MIP validation in fetch-artifact.sh only checks
executability, so a directory can still pass and fail later in the materialize
step. Tighten the existing MIP branch by validating that $MIP is a regular
executable file before using it, keeping the check near the current [ -x "$MIP"
] guard and preserving the same fallback build-from-source path when MIP is
unset.

In `@scripts/fetch-libkrun.sh`:
- Around line 44-52: The MIP resolution block in fetch-libkrun.sh duplicates the
same fallback/validation logic used by fetch-artifact.sh, so extract it into a
shared helper such as resolve_mip in a sourced script under scripts/lib and have
both scripts call that helper instead. While refactoring, keep the existing
executable check in the MIP branch (the same -x validation used in the current
MIP handling) so the behavior stays consistent and doesn’t drift between the two
scripts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c883f61-040d-487f-9b05-b62ef71de522

📥 Commits

Reviewing files that changed from the base of the PR and between 096d292 and 4b87e21.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • scripts/fetch-artifact.sh
  • scripts/fetch-libkrun.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

@twitchyliquid64
twitchyliquid64 enabled auto-merge (squash) July 3, 2026 01:08
@twitchyliquid64
twitchyliquid64 merged commit 3a6f564 into main Jul 3, 2026
52 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/release branch July 3, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants