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

OCPBUGS-51209: Fixing artifact name issue for vmlinuz in latest rhelVersions #355

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

veera-damisetti
Copy link

@veera-damisetti veera-damisetti commented Mar 4, 2025

Fixing artifact name issue for vmlinuz in latest rhelVersions ( starting from 9.6 )

  • Updated boot_artifacts.go to change artifact name to vmliuz from kernel.img based on RHCOS version

Description

  • Starting from RHEL9.6 , artifact name for kernel has changed to vmliuz from kernel.img. this is breaking the existing flow in Hosted Control Plane and Assisted Installer.

  • Updated the logic to change the artifact name based the RHEL Version.

How was this code tested?

  • Built a test image with assisted-image-service
  • Using this test image, created AgentServiceConfig and InfraEnv objects, and validated the images generated in InfraEnv.

Assignees

@AmadeusPodvratnik

cc @v78singh
cc @phani2898

Links

https://issues.redhat.com/browse/OCPBUGS-51209

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)

…mlinuz from kernel.img based on RHCOS version

Signed-off-by: DAMISETTI-VEERABHADRARAO <[email protected]>
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important 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 Mar 4, 2025
@openshift-ci-robot
Copy link

@veera-damisetti: This pull request references Jira Issue OCPBUGS-51209, which is invalid:

  • expected the bug to target the "4.19.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.

In response to this:

Fixing artifact name issue for vmlinuz in latest rhelVersions ( starting from 9.6 )

  • Updated boot_artifacts.go to change artifact name to vmliuz from kernel.img based on RHCOS version

Description

  • Starting from RHEL9.6 , artifact name for kernel has changed to vmliuz from kernel.img. this is breaking the existing flow in Hosted Control Plane and Assisted Installer.

  • Updated the logic to change the artifact name based the RHEL Version.

How was this code tested?

  • Built a test image with assisted-image-service
  • Using this test image, created AgentServiceConfig and InfraEnv objects, and validated the images generated in InfraEnv.

Assignees

cc @v78singh
cc @phani2898

Links

https://issues.redhat.com/browse/OCPBUGS-51209

Checklist

  • [ x ] Title and description added to both, commit and PR
  • [ x ] Relevant issues have been associated
  • Reviewers have been listed
  • [ x ] This change does not require a documentation update (docstring, docs, README, etc)
  • [ x ] 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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 4, 2025
Copy link

openshift-ci bot commented Mar 4, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 4, 2025
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.

This should not be done based on a file name.
Users can mirror these ISOs and change the name to whatever they want.

@@ -19,23 +20,29 @@ type BootArtifactsHandler struct {

var _ http.Handler = &BootArtifactsHandler{}

var IsoFileName string
Copy link
Member

Choose a reason for hiding this comment

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

Don't create or use globals like this.

@veera-damisetti veera-damisetti marked this pull request as ready for review March 5, 2025 04:46
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 5, 2025
@openshift-ci openshift-ci bot requested review from eranco74 and omertuc March 5, 2025 04:47
@veera-damisetti
Copy link
Author

This should not be done based on a file name. Users can mirror these ISOs and change the name to whatever they want.

Thanks @carbonin for the quick review.

Even if we are mirroring ISO and changing the name while providing ISO URL, IsoFileName is always coming with version and RHCOS version.

For example, we have ISO URL from mirror, https://mirror.openshift.com/pub/openshift-v4/s390x/dependencies/rhcos/4.18/4.18.1/rhcos-4.18.1-s390x-live.s390x.iso
Still IsoFilename is getting generated with version and RHCOS version.
Printing ISO File name for debug: /data/rhcos-full-iso-4.18.1-418.94.202502100215-0-s390x.iso

Is this the scenario which you are indicating where user can mirror ISO and change the name ?

@veera-damisetti
Copy link
Author

/test edge-test

@veera-damisetti
Copy link
Author

/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 Mar 5, 2025
@openshift-ci-robot
Copy link

@veera-damisetti: This pull request references Jira Issue OCPBUGS-51209, which is valid.

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

Requesting review from QA contact:
/cc @mhanss

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 openshift-ci bot requested a review from mhanss March 5, 2025 07:54
@veera-damisetti
Copy link
Author

/test edge-test

@carbonin
Copy link
Member

carbonin commented Mar 5, 2025

Still IsoFilename is getting generated with version and RHCOS version

Okay, I remember this now. Let me take a closer look when I get time and see if this still makes sense.

@veera-damisetti
Copy link
Author

veera-damisetti commented Mar 5, 2025

Sure @carbonin thanks
Once we reach a conclusion here, I will remove IsoFilename as a global variable and update the code to pass it as a function parameter.

…eter to parseArtifact function and updated unit tests accrodingly

Signed-off-by: DAMISETTI-VEERABHADRARAO <[email protected]>
Copy link

openshift-ci bot commented Mar 6, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: veera-damisetti
Once this PR has been reviewed and has the lgtm label, please ask for approval from carbonin. For more information see the Code Review Process.

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

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

@carbonin
Copy link
Member

carbonin commented Mar 6, 2025

Still IsoFilename is getting generated with version and RHCOS version.
Printing ISO File name for debug: /data/rhcos-full-iso-4.18.1-418.94.202502100215-0-s390x.iso

Okay, so the issue here is still that these values (4.18 and 418.94.202502100215-0) are still coming from user input and could technically be arbitrary identifiers.
I'm not sure we actually validate their format or correctness anywhere.
Unfortunately we're already relying on these being valid to some degree with the nmstate changes @linoyaslan made, but maybe we want to re-evaluate that and use the actual ISO volume identifier for a better source of truth for these kinds of versions.

In any case I think a simpler solution for you would be to just look for both files in the ISO rather than trying to identify which file is the correct one based on the version.

I'm not sure if this is 100% correct as I put it together rather quickly, but maybe something like this instead:

diff --git a/internal/handlers/boot_artifacts.go b/internal/handlers/boot_artifacts.go
index 0f09b9c..7e4fc20 100644
--- a/internal/handlers/boot_artifacts.go
+++ b/internal/handlers/boot_artifacts.go
@@ -49,6 +49,15 @@ func parseArtifact(path, arch string) (string, error) {
        return artifact, nil
 }
 
+func getArtifactFilePath(artifact string) string {
+       filePath := fmt.Sprintf("/images/pxeboot/%s", artifact)
+       if artifact == "generic.ins" {
+               // s390x only, unlike other artifacts this one is at the root of the ISO
+               filePath = fmt.Sprintf("/%s", artifact)
+       }
+       return filePath
+}
+
 func (b *BootArtifactsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
        if r.Method != http.MethodGet && r.Method != http.MethodHead {
                log.Error("Only GET and HEAD methods are supported with this endpoint.")
@@ -70,13 +79,11 @@ func (b *BootArtifactsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
        }
 
        isoFileName := b.ImageStore.PathForParams(imagestore.ImageTypeFull, version, arch)
-       file_path := fmt.Sprintf("/images/pxeboot/%s", artifact)
-       if artifact == "generic.ins" {
-               // s390x only, unlike other artifacts this one is at the root of the ISO
-               file_path = fmt.Sprintf("/%s", artifact)
+       fileReader, err := isoeditor.GetFileFromISO(isoFileName, getArtifactFilePath(artifact))
+       // retry with the old kernel file name if vmlinuz is not found on s390x
+       if err != nil && arch == "s390x" && artifact == "vmlinuz" {
+               fileReader, err = isoeditor.GetFileFromISO(isoFileName, getArtifactFilePath("kernel.img"))
        }
-
-       fileReader, err := isoeditor.GetFileFromISO(isoFileName, file_path)
        if err != nil {
                httpErrorf(w, http.StatusInternalServerError, "Error creating file reader stream: %v", err)
                return

Maybe we'd also want to put these artifacts names in constants or something, but I'm just posting this to help you understand my idea for moving this away form relying on parsing out versions in any real way.

Copy link

openshift-ci bot commented Mar 6, 2025

@veera-damisetti: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/edge-test d5e0678 link true /test edge-test

Full PR test history. Your PR dashboard.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/severity-important Referenced Jira bug's severity is important 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants