Skip to content

fix: validate ISO prerequisites before expensive build operations#518

Open
arodage wants to merge 3 commits intomainfrom
fix/iso-live-installer-validation
Open

fix: validate ISO prerequisites before expensive build operations#518
arodage wants to merge 3 commits intomainfrom
fix/iso-live-installer-validation

Conversation

@arodage
Copy link
Copy Markdown
Contributor

@arodage arodage commented Apr 16, 2026

Merge Checklist

All boxes should be checked before merging the PR

  • The changes in the PR have been built and tested
  • Documentation has been updated to reflect the changes (or no doc update needed)
  • Ready to merge

Description

ISO builds require the live-installer binary, but previously this was only
discovered late in the build when addImageAdditionalFiles() failed after
expensive provider init, repo metadata fetching, and package downloads.

This PR adds early validation of additional files referenced in ISO templates
before any provider initialization or package download begins. When
live-installer is missing, the build now fails immediately with a clear,
actionable error message including the exact build command needed.

Changes:

  • Added ValidateISOPrerequisites() and ValidateAdditionalFiles() exported
    functions in internal/image/isomaker/ that check all additional files exist
    before expensive operations
  • Added early ISO prerequisite check in cmd/os-image-composer/build.go right
    after template loading, before provider init
  • Updated README.md and docs/tutorial/usage-guide.md with live-installer
    build prerequisite callout for ISO builds

Before: Build downloads packages for minutes, then fails deep in chroot
After:

Error: ISO prerequisites check failed: live-installer binary not found
(referenced as ../../../../../../build/live-installer).
Build it first: go build -buildmode=pie -o ./build/live-installer ./cmd/live-installer

Any Newly Introduced Dependencies

None.

How Has This Been Tested?

  • Manual test (missing binary): Renamed build/live-installer, ran
    sudo -E ./build/os-image-composer build image-templates/emt3-x86_64-minimal-iso.yml
  • build failed immediately with the expected error message
  • Manual test (binary present): Restored build/live-installer, confirmed
    build proceeds past validation
  • Existing tests: All isomaker and build command tests pass

Add early validation of additional files (e.g., live-installer binary)
before provider init and package downloads. Previously, a missing
live-installer caused a late failure after expensive operations.

- Add ValidateISOPrerequisites() to isomaker package
- Call it from build.go before provider init for ISO builds
- Provide actionable error message with build command hint
- Add unit tests for ValidateAdditionalFiles
- Document live-installer prerequisite in README and usage guide
@arodage arodage requested review from a team as code owners April 16, 2026 14:47
Copilot AI review requested due to automatic review settings April 16, 2026 14:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an early, fail-fast validation step for ISO builds to ensure required “additional files” (notably the live-installer binary) are present before starting expensive provider initialization and package download work.

Changes:

  • Introduces exported ISO validation helpers in internal/image/isomaker/ and unit tests for them.
  • Calls ISO prerequisite validation early in the build command flow (immediately after template loading).
  • Documents the live-installer prerequisite in README.md and the tutorial usage guide.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/image/isomaker/isomaker.go Adds ValidateISOPrerequisites / ValidateAdditionalFiles and invokes validation before initrd maker creation.
cmd/os-image-composer/build.go Runs ISO prerequisite validation before provider init/package downloads.
internal/image/isomaker/validate_test.go Adds table-driven tests for additional-file validation behavior and messaging.
docs/tutorial/usage-guide.md Documents live-installer build prerequisite for ISO builds.
README.md Adds the same prerequisite callout for ISO builds in the quickstart flow.

Comment thread internal/image/isomaker/validate_test.go
Comment thread internal/image/isomaker/isomaker.go
Comment thread internal/image/isomaker/isomaker.go
Comment thread internal/image/isomaker/isomaker.go
Comment thread internal/image/isomaker/isomaker.go Outdated
arodage added 2 commits April 16, 2026 23:51
- Add nil template guard to ValidateAdditionalFiles
- Distinguish os.IsNotExist from other os.Stat errors (EACCES, IO)
- Verify paths are regular files, not directories
- Emit live-installer build hint for both absolute and relative paths
- Add edge case tests: nil template, empty PathList, directory-as-file
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