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

Merged
merged 2 commits into from
Jan 27, 2025

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 97.63780% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.81%. Comparing base (1c50407) to head (11b7f49).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/Components/CreateImageWizard/validators.ts 66.66% 2 Missing ⚠️
src/store/wizardSlice.ts 95.83% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2734      +/-   ##
==========================================
+ Coverage   84.77%   84.81%   +0.04%     
==========================================
  Files         187      187              
  Lines       21298    21388      +90     
  Branches     2099     2120      +21     
==========================================
+ Hits        18055    18141      +86     
- Misses       3221     3225       +4     
  Partials       22       22              
Files with missing lines Coverage Δ
src/Components/CreateImageWizard/ChippingInput.tsx 100.00% <100.00%> (ø)
...Wizard/steps/Kernel/components/KernelArguments.tsx 100.00% <100.00%> (ø)
...Components/CreateImageWizard/steps/Oscap/Oscap.tsx 92.80% <100.00%> (+0.17%) ⬆️
...mageWizard/steps/Oscap/OscapProfileInformation.tsx 100.00% <ø> (ø)
...Components/CreateImageWizard/steps/Oscap/index.tsx 98.27% <100.00%> (ø)
...nents/CreateImageWizard/utilities/requestMapper.ts 94.79% <100.00%> (+0.07%) ⬆️
src/test/fixtures/oscap.ts 100.00% <100.00%> (ø)
src/store/wizardSlice.ts 88.94% <95.83%> (+0.16%) ⬆️
src/Components/CreateImageWizard/validators.ts 93.39% <66.66%> (-1.61%) ⬇️

... and 1 file with indirect coverage changes


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 199dd3d...11b7f49. 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
@regexowl regexowl force-pushed the kernel-append-input branch from 60653e7 to 526afe0 Compare January 17, 2025 10:48
@regexowl regexowl force-pushed the kernel-append-input branch 4 times, most recently from 7bab478 to f1fb5ff Compare January 22, 2025 12:02
@regexowl regexowl marked this pull request as ready for review January 22, 2025 12:11
@regexowl regexowl force-pushed the kernel-append-input branch 3 times, most recently from 2fbfe23 to c0c13fc Compare January 23, 2025 08:10
@regexowl
Copy link
Collaborator Author

/retest

@@ -64,7 +66,7 @@ const ChippingInput = ({
};

const handleKeyDown = (e: React.KeyboardEvent, value: string) => {
if (e.key === ' ' || e.key === 'Enter' || e.key === ',') {
if (e.key === ' ' || e.key === 'Enter') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comma should be a valid character for kernel argument, I've removed it from the keyDown for the consistency sake.

Copy link
Collaborator

@kingsleyzissou kingsleyzissou left a comment

Choose a reason for hiding this comment

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

Looks good, just a small nitpick that I added inline, but should block the PR.

@regexowl
Copy link
Collaborator Author

/retest

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.
Removed redundant code and updated `addItem` to check for duplicate arguments in both required and non-required list.
@regexowl
Copy link
Collaborator Author

/retest

@regexowl regexowl enabled auto-merge (rebase) January 27, 2025 12:07
@regexowl regexowl merged commit 6a29f7f into osbuild:main Jan 27, 2025
17 of 19 checks passed
@regexowl regexowl deleted the kernel-append-input branch January 27, 2025 12:23
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.

3 participants