Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for arbitrary kickstart file injection into ISOs (HMS-3879) #438

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

achilleas-k
Copy link
Member

@ochosi ochosi changed the title Add support for arbitrary kickstart file injection into ISOs Add support for arbitrary kickstart file injection into ISOs (HMS-3879) May 16, 2024
@chunfuwen
Copy link

chunfuwen commented May 20, 2024

Does this PR link to this issue #433 ?

@achilleas-k
Copy link
Member Author

Does this PR link to this issue #433 ?

No, this is a feature for the anaconda-iso to allow users to add their own kickstart files directly to the iso at build time.

@cdrage
Copy link
Contributor

cdrage commented Jun 3, 2024

@achilleas-k I'm trying to figure out how to test this, I've got a cluster machine that uses RAID5 so I'm hoping to inject something like this:

# Use the entire disk automatically
clearpart --all --initlabel

# Create RAID partitions on each disk
part raid.01 --size=1 --ondisk=sda --asprimary
part raid.02 --size=1 --ondisk=sdb --asprimary
part raid.03 --size=1 --ondisk=sdc --asprimary
part raid.04 --size=1 --ondisk=sdd --asprimary

part raid.1 --size=100 --grow --ondisk=sda --asprimary
part raid.2 --size=100 --grow --ondisk=sdb --asprimary
part raid.3 --size=100 --grow --ondisk=sdc --asprimary
part raid.4 --size=100 --grow --ondisk=sdd --asprimary

# Create the RAID 5 array
raid / --level=5 --device=md0 --fstype="ext4" raid.1 raid.2 raid.3 raid.4

# Specify bootloader installation (adjust as necessary for your setup)
bootloader --location=mbr --driveorder=sda,sdb,sdc,sdd --append="rhgb quiet"

into it, then boot it and have it auto-configure.

For this PR, I'm unable to see what volume / param I should pass in to bootc-image-builder image to pass in the kickstart file?

My second question is that I'm assuming that I won't need to elaborate on the entire install in the kickstart file / just inject what I need?

@achilleas-k
Copy link
Member Author

I haven't tested it here yet, though it's the same code as in obuild/images which has been tested. The way to add it is through the config.toml (toml is more convenient than json in this case):

[customizations.installer.kickstart]
contents = """
<bunch of kickstart stuff>
"""

My second question is that I'm assuming that I won't need to elaborate on the entire install in the kickstart file / just inject what I need?

bootc-image-builder will add the ostreecontainer line for the base container and then append the stuff from customizations and that's it. Everything else is up to the user.

@chunfuwen
Copy link

@achilleas-k So when pass in user own kickstart file to bootc-image-builder , what happen to previously existed kickstart for unattended iso ? Would both kickstart files be merged as one ?

@achilleas-k
Copy link
Member Author

achilleas-k commented Jun 4, 2024

@achilleas-k So when pass in user own kickstart file to bootc-image-builder , what happen to previously existed kickstart for unattended iso ? Would both kickstart files be merged as one ?

bootc-image-builder will add the ostreecontainer line for the base container and then append the stuff from customizations and nothing else.
It's up to the user to write a kickstart that makes the installation unattended, interactive, or anything they want. Doing anything more inside bootc-image-builder during the ISO build would be incredibly error prone. We would have to parse the user's kickstart contents to figure out what we need to add (and where) and that's far beyond the scope of this change.

@achilleas-k
Copy link
Member Author

Tests added. Ready for review.

Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

This is awesome, can you please document it in README.md?

@ondrejbudai
Copy link
Member

Also, one usability thought: IIUC, the kickstart is now passed via customization.toml... I wonder if we should also allow just mounting it in, e.g. -v kickstart.ks:/kickstart.ks. This way, users wouldn't have to embed their already existing kickstarts into a blueprint.

@achilleas-k
Copy link
Member Author

This is awesome, can you please document it in README.md?

Done!

@achilleas-k
Copy link
Member Author

Also, one usability thought: IIUC, the kickstart is now passed via customization.toml... I wonder if we should also allow just mounting it in, e.g. -v kickstart.ks:/kickstart.ks. This way, users wouldn't have to embed their already existing kickstarts into a blueprint.

Not sure how much easier that makes it, but if you want we can add it. Here or follow-up?

Copy link
Collaborator

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you! This is nice and I'm happy to approve, but I do have a question/discussion point inline that I would like to resolve first (could be resolved in a followup of course if we are in a hurray :)

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
test/test_manifest.py Show resolved Hide resolved
test/test_manifest.py Show resolved Hide resolved
The structure of the kickstart-related options on the BootcDiskImage
type have changed and are now all centralised under a Kickstart struct
with type kickstart.Options.
The existing manifest smoke test only generates the disk image manifest.
Adding a separate manifest smoke test for ISOs.  We use a separate test
that doesn't check for disk size but instead verifies the expected
pipeline names.
achilleas-k and others added 2 commits July 3, 2024 13:34
Add a custom kickstart file to an ISO config and check the manifest for
the expected input and stage.

Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
Add an example for installer customizations to the README.  Include the
same example in both toml and json format for better readability.
Unlike other examples, the toml format is shown first since it's easier
to work with.

Add a note for users explaining that the ostreecontainer command is
automatically added to the kickstart file when building an ISO.  Mention
that no other command is added so the user should include any other
options they need.

Link to the docs for up-to-date information on interactions with other
commands.
@achilleas-k achilleas-k requested a review from mvo5 July 3, 2024 11:35
@achilleas-k
Copy link
Member Author

Please re review nitpick :)

Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

Thanks!

@achilleas-k achilleas-k added this pull request to the merge queue Jul 3, 2024
Merged via the queue into osbuild:main with commit f5e218a Jul 3, 2024
7 of 9 checks passed
@achilleas-k achilleas-k deleted the user-kickstarts branch July 4, 2024 09:58
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.

5 participants