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

Wizard: Add kernel append input (HMS-5299) #2734

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

regexowl
Copy link
Collaborator

@regexowl regexowl commented Jan 10, 2025

This adds the kernel append input, removes kernel append from the OpenSCAP step and adds basic tests to cover the functionality.

TO DO:

  • parse "Required by OpenSCAP" correctly on edit
  • check for duplicate arguments

JIRA: HMS-5299

@regexowl
Copy link
Collaborator Author

/jira-epic HMS-5192

@schutzbot schutzbot changed the title Wizard: Add kernel append input Wizard: Add kernel append input (HMS-5299) Jan 10, 2025
@regexowl regexowl force-pushed the kernel-append-input branch from 6199c02 to 418f4aa Compare January 10, 2025 09:59
@regexowl regexowl force-pushed the kernel-append-input branch from 418f4aa to 265fa11 Compare January 10, 2025 10:13
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 91.62304% with 16 lines in your changes missing coverage. Please review.

Project coverage is 84.77%. Comparing base (52efa80) to head (526afe0).

Files with missing lines Patch % Lines
...Wizard/steps/Kernel/components/KernelArguments.tsx 88.88% 13 Missing ⚠️
src/Components/CreateImageWizard/validators.ts 66.66% 2 Missing ⚠️
src/store/wizardSlice.ts 95.45% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2734      +/-   ##
==========================================
+ Coverage   84.73%   84.77%   +0.04%     
==========================================
  Files         186      186              
  Lines       20955    21120     +165     
  Branches     2033     2064      +31     
==========================================
+ Hits        17756    17905     +149     
- Misses       3177     3193      +16     
  Partials       22       22              
Files with missing lines Coverage Δ
...Components/CreateImageWizard/steps/Oscap/Oscap.tsx 92.87% <100.00%> (+0.25%) ⬆️
...mageWizard/steps/Oscap/OscapProfileInformation.tsx 100.00% <ø> (ø)
...Components/CreateImageWizard/steps/Oscap/index.tsx 98.27% <100.00%> (ø)
...nents/CreateImageWizard/utilities/requestMapper.ts 94.95% <100.00%> (+0.10%) ⬆️
src/test/fixtures/oscap.ts 100.00% <100.00%> (ø)
src/store/wizardSlice.ts 88.84% <95.45%> (+0.13%) ⬆️
src/Components/CreateImageWizard/validators.ts 92.30% <66.66%> (-1.81%) ⬇️
...Wizard/steps/Kernel/components/KernelArguments.tsx 89.16% <88.88%> (-10.84%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52efa80...526afe0. Read the comment docs.

@mgold1234
Copy link
Collaborator

mgold1234 commented Jan 13, 2025

I think there is a bug when creating an image with OScap -> required kernel added to the kernel step,
and if you open the edit image, the required kernel change to false
https://github.com/user-attachments/assets/13668299-9b04-4b45-8a1f-c185646147a9
Screenshot 2025-01-13 at 12 54 07

setErrorText('');
}

if (kernelAppend.some((arg) => arg.name === value)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should I see this error in case I am adding the same kernel name?
now I dont see any error when adding the same name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, yeah, we don't want duplicates. Will add a check for that!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried to add a duplicate and got the correct error
image

What arguments did you try to add?

Copy link
Collaborator

@mgold1234 mgold1234 Jan 14, 2025

Choose a reason for hiding this comment

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

I tried 'test' value

Screen.Recording.2025-01-14.at.14.03.32.mov

Copy link
Collaborator

@mgold1234 mgold1234 Jan 14, 2025

Choose a reason for hiding this comment

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

ok, I got you, I think I check that I am adding 2 times the same value 'test',
if I tried to add same value that comes from the oscap profile the validation also doesnt work for me.
but, maybe we also want to check if user try to add same value ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Aah, gotcha, the validation was triggered only on keyDown 😳 will add a fix in a bit. Nice catch, thanks!

@regexowl
Copy link
Collaborator Author

I think there is a bug when creating an image with OScap -> required kernel added to the kernel step, and if you open the edit image, the required kernel change to false https://github.com/user-attachments/assets/13668299-9b04-4b45-8a1f-c185646147a9 Screenshot 2025-01-13 at 12 54 07

Ooh, I left the default parsing there, didn't I? Great catch! Will revert this to draft

@regexowl regexowl marked this pull request as draft January 13, 2025 10:56
@regexowl regexowl force-pushed the kernel-append-input branch from 265fa11 to 74217f1 Compare January 14, 2025 08:38
@regexowl regexowl marked this pull request as ready for review January 14, 2025 08:38
@regexowl regexowl force-pushed the kernel-append-input branch from 74217f1 to b6c7247 Compare January 14, 2025 09:12
@regexowl regexowl force-pushed the kernel-append-input branch 3 times, most recently from 728676c to 60653e7 Compare January 15, 2025 13:03
@regexowl
Copy link
Collaborator Author

The chipping input might be extractable from this one as well, moving to draft for the time being. #2747 will need to get merged first.

@regexowl regexowl marked this pull request as draft January 16, 2025 09:27
This is in a preparation to expose kernel append customization.

It will be easier to mutate kernel append if it's represented as an array of arguments, rather than currently used string.
This adds the kernel append input. New arguments can be added by pressing the "Add" button or hitting Enter after the argument.

The kernel arguments linked to a selected OpenSCAP profile are rendered in a category marked as "Required by OpenSCAP" and are read only.
This removes kernel append from the list of information about the selected OpenSCAP step.
This adds basic tests for kernel append.
This updates the way the arguments are sorted by whether they're required by a selected OpenSCAP profile.
Only `keyDown` was validated, this makes sure that the plus button value is validated as well.

Also the error text gets removed on change or clear.
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