Skip to content

Conversation

@zaneb
Copy link
Member

@zaneb zaneb commented Dec 10, 2025

Description

When editing the bootloader files in the minimal ISO, update kargs.json so that it maintains the correct default args, embed area offsets, and embed area sizes. This allows the kernel arguments in the ISO to be manipulated by the user with coreos-installer commands.

This PR is based on top of #620, which is a prerequisite for fixing the bug.

How was this code tested?

Generated a minimal ISO using this code and verified that coreos-installer can see and edit the kargs.

Assignees

/cc @carbonin

Links

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci bot requested a review from carbonin December 10, 2025 20:00
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 10, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is invalid:

  • expected the bug to target either version "4.21." or "openshift-4.21.", but it targets "4.20.z" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Description

When editing the bootloader files in the minimal ISO, update kargs.json so that it maintains the correct default args, embed area offsets, and embed area sizes. This allows the kernel arguments in the ISO to be manipulated by the user with coreos-installer commands.

How was this code tested?

Assignees

/cc @carbonin

Links

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 10, 2025
@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zaneb
Once this PR has been reviewed and has the lgtm label, please assign gamli75 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zaneb
Copy link
Member Author

zaneb commented Dec 10, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 10, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 73.91304% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.51%. Comparing base (7231c9f) to head (ea20b7d).

Files with missing lines Patch % Lines
pkg/isoeditor/rhcos.go 74.54% 13 Missing and 15 partials ⚠️
internal/handlers/initrd_addrsize.go 0.00% 1 Missing ⚠️
pkg/isoeditor/nmstate_handler.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #618      +/-   ##
==========================================
+ Coverage   59.02%   60.51%   +1.49%     
==========================================
  Files          27       27              
  Lines        1674     1755      +81     
==========================================
+ Hits          988     1062      +74     
- Misses        524      527       +3     
- Partials      162      166       +4     
Files with missing lines Coverage Δ
internal/handlers/initrd.go 71.42% <100.00%> (ø)
pkg/isoeditor/isoutil.go 64.38% <100.00%> (ø)
internal/handlers/initrd_addrsize.go 58.33% <0.00%> (ø)
pkg/isoeditor/nmstate_handler.go 47.15% <0.00%> (ø)
pkg/isoeditor/rhcos.go 61.45% <74.54%> (+21.81%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci openshift-ci bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 11, 2025
@zaneb
Copy link
Member Author

zaneb commented Dec 11, 2025

/retitle OCPBUGS-43501,OCPBUGS-64929: Handle kargs.json correctly in minimal ISO

@openshift-ci openshift-ci bot changed the title OCPBUGS-43501: Handle kargs.json correctly in minimal ISO OCPBUGS-43501,OCPBUGS-64929: Handle kargs.json correctly in minimal ISO Dec 11, 2025
@openshift-ci-robot openshift-ci-robot added jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. and removed jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Dec 11, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

The bug has been updated to refer to the pull request using the external bug tracker.

This pull request references Jira Issue OCPBUGS-64929, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Description

When editing the bootloader files in the minimal ISO, update kargs.json so that it maintains the correct default args, embed area offsets, and embed area sizes. This allows the kernel arguments in the ISO to be manipulated by the user with coreos-installer commands.

How was this code tested?

Assignees

/cc @carbonin

Links

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

This pull request references Jira Issue OCPBUGS-64929, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

Description

When editing the bootloader files in the minimal ISO, update kargs.json so that it maintains the correct default args, embed area offsets, and embed area sizes. This allows the kernel arguments in the ISO to be manipulated by the user with coreos-installer commands.

Also, when extracting ISO files, rename them to 8.3 format so that when they are repacked into an ISO they will have ISO 9660 Level 1 compatible filenames, which is necessary for coreos-installer to make use of them. A proper fix for this is diskfs/go-diskfs#315, but for now we are copying the fix already used in the installer so that it applies to all consumers of the library.

How was this code tested?

Generated a minimal ISO using this code and verified that coreos-installer can see and edit the kargs.

Assignees

/cc @carbonin

Links

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@zaneb
Copy link
Member Author

zaneb commented Dec 11, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Dec 11, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

This pull request references Jira Issue OCPBUGS-64929, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Dec 11, 2025
@zaneb zaneb force-pushed the minimal-kargs branch 2 times, most recently from ef112b8 to ab25b69 Compare December 11, 2025 03:55
Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

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

Can we rename some of the functions so it's easier to understand the difference between updateKargs, updateKernelArgs, and updateDefaultKargs?

Upgrade the minimum Go version from 1.23 to 1.24.0 in preparation for
upgrading to diskfs v1.7.0, which requires Go 1.24.0.

Also fix the logging format string warning that appears with Go 1.24.0+
by removing the unnecessary fmt.Sprintf() wrapper around log.Infof().

Assisted-by: Claude Code
Update to diskfs v1.7.0 to prepare for using the upstream fix for
ISO 9660 filename extension truncation (PR openshift#315).

API changes:
- diskfs.Create() no longer takes diskfs.Raw parameter
- disk.Disk.File field replaced with disk.Disk.Backend

All tests pass with the updated API.

Assisted-by: Claude Code
Upgrade to diskfs master (commit 58541aa) which includes the fix to
properly truncate file extensions to 3 characters for ISO 9660 Level 1
compatibility.

This fixes the issue where coreos-installer couldn't find kargs.json
because diskfs was creating KARGS.JSON (invalid 4-char extension)
instead of KARGS.JSO (valid 3-char extension).

With this fix, diskfs now correctly creates ISO 9660 short names with
truncated extensions, making minimal ISOs compatible with tools like
coreos-installer that access files using their ISO 9660 short names.

Assisted-by: Claude Code
Quoting is required in grub.cfg, and was added in MGMT-4693. This solves
the problem that the '&' character in a URL is considered a word
separator by Grub.

However, having different kernel args between isolinux.cfg and grub.cfg
is likely problematic for coreos-installer when editing kargs. Making
them the same length also avoids the need to adjust padding in order to
keep the same embed area length in each file (which is required, as
kargs.json does not store per-file embed area sizes).

isolinux.cfg does not use quoting, so the parameter will be passed to
the kernel quoted. The kernel will only strip double quotes, not single
quotes.

In grub.cfg, using double quotes allows the expansion of variables with
'$' and escaping with '\' (both of which are suppressed when using
single quotes). '\' is not a valid character in a URL. '$' technically
is, but is vanishingly rare. We will prohibit these characters so that
we can use the same kargs in both files.

Assisted-by: Cursor
Consolidate the duplicated logic for modifying kernel arguments into a
single transformKernelArgs() function. This function:
- Validates the rootfs URL
- Removes the coreos.liveiso parameter
- Adds the coreos.live.rootfs_url parameter at a specified position

Both fixGrubConfig and fixIsolinuxConfig use this single implementation
instead of each having their own inline logic. This eliminates code
duplication and makes the transformation logic easier to understand
and maintain.

Assisted-by: Cursor
Assisted-by: Claude Code
Introduce editString() function that uses named capture groups to
precisely target content for replacement. The (?P<replace>) syntax
makes it explicit what is being replaced in each regex operation.

Convert transformKernelArgs, fixGrubConfig and fixIsolinuxConfig to use
editString for their transformations. This provides better control
over regex substitutions than full-string replacement.

Assisted-by: Cursor
Assisted-by: Claude Code
Read and update kargs.json metadata that coreos-installer uses to
manage kernel arguments in the ISO. When we modify the default kernel
arguments (removing coreos.liveiso and adding coreos.live.rootfs_url),
update kargs.json to reflect these changes.

This ensures coreos-installer can correctly edit kernel arguments
after the ISO is created.

Assisted-by: Cursor
Assisted-by: Claude Code
When modifying kernel arguments in grub.cfg or isolinux.cfg, track how
these changes shift the position of the kargs embed area. Update the
offsets in kargs.json so that coreos-installer can find the correct
embed area after our modifications.

Without this fix, adding initramfs images in isolinux.cfg can shift
the kargs embed area, causing coreos-installer kargs edits to fail or
corrupt the file.

Assisted-by: Cursor
Assisted-by: Claude Code
@openshift-ci
Copy link

openshift-ci bot commented Dec 17, 2025

@zaneb: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci-robot openshift-ci-robot added jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. and removed jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Dec 17, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is invalid:

  • expected the bug to target either version "4.22." or "openshift-4.22.", but it targets "4.21.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

This pull request references Jira Issue OCPBUGS-64929, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

Description

When editing the bootloader files in the minimal ISO, update kargs.json so that it maintains the correct default args, embed area offsets, and embed area sizes. This allows the kernel arguments in the ISO to be manipulated by the user with coreos-installer commands.

This PR is based on top of #620, which is a prerequisite for fixing the bug.

How was this code tested?

Generated a minimal ISO using this code and verified that coreos-installer can see and edit the kargs.

Assignees

/cc @carbonin

Links

Checklist

  • Title and description added to both, commit and PR
  • Relevant issues have been associated
  • Reviewers have been listed
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit tests (note that code changes require unit tests)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@zaneb
Copy link
Member Author

zaneb commented Dec 18, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 18, 2025
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-43501, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

This pull request references Jira Issue OCPBUGS-64929, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants