fix: validate ISO prerequisites before expensive build operations#518
Open
fix: validate ISO prerequisites before expensive build operations#518
Conversation
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
Contributor
There was a problem hiding this comment.
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
buildcommand flow (immediately after template loading). - Documents the
live-installerprerequisite inREADME.mdand 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. |
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge Checklist
All boxes should be checked before merging the PR
Description
ISO builds require the
live-installerbinary, but previously this was onlydiscovered late in the build when
addImageAdditionalFiles()failed afterexpensive 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-installeris missing, the build now fails immediately with a clear,actionable error message including the exact build command needed.
Changes:
ValidateISOPrerequisites()andValidateAdditionalFiles()exportedfunctions in
internal/image/isomaker/that check all additional files existbefore expensive operations
cmd/os-image-composer/build.gorightafter template loading, before provider init
README.mdanddocs/tutorial/usage-guide.mdwith live-installerbuild prerequisite callout for ISO builds
Before: Build downloads packages for minutes, then fails deep in chroot
After:
Any Newly Introduced Dependencies
None.
How Has This Been Tested?
build/live-installer, ransudo -E ./build/os-image-composer build image-templates/emt3-x86_64-minimal-iso.ymlbuild/live-installer, confirmedbuild proceeds past validation