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

feat: skip install tools cmd #741

Merged
merged 12 commits into from
Aug 30, 2024

Conversation

MiahaCybersec
Copy link
Contributor

Closes #651, #652

Miaha Cybersec and others added 4 commits August 13, 2024 14:41
Commented out the hardcoded install command and introduced a new method to dynamically generate the command based on the available package managers and missing tools in the tooling image. This enhancement increases flexibility and ensures the tooling image has all required tools installed using the detected package manager.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
Extended the list of package managers to include 'rpm' in the pkgmgr. Added error handling for unsupported RedHat and RockyLinux source policies due to missing busybox in their repos.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
Changed `generateToolInstallCmd` to accept pointer of llb.State for better efficiency. Removed redundant `rpm` package manager as it cannot connect to RPM repos.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
@MiahaCybersec
Copy link
Contributor Author

Currently working on fixing the failing test

Added `tdnf` as a required package manager in test cases for `Test_unpackAndMergeUpdates_RPM`. This ensures tests do not fail due to the absence of a specified package manager.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 43.58974% with 22 lines in your changes missing coverage. Please review.

Project coverage is 47.43%. Comparing base (7b26e85) to head (5983bea).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/pkgmgr/rpm.go 58.62% 9 Missing and 3 partials ⚠️
pkg/patch/patch.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #741      +/-   ##
==========================================
- Coverage   47.46%   47.43%   -0.04%     
==========================================
  Files          18       18              
  Lines        1677     1714      +37     
==========================================
+ Hits          796      813      +17     
- Misses        826      843      +17     
- Partials       55       58       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/pkgmgr/rpm.go Outdated Show resolved Hide resolved
MiahaCybersec and others added 3 commits August 22, 2024 10:50
Simplify the loop for checking required tools by using more descriptive variable names and range iteration syntax. This improves readability and maintainability of the code.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
@ashnamehrotra
Copy link
Contributor

@MiahaCybersec when testing this locally, it does work with a cbl-mariner to Fedora conversion source policy and doesn't work with Redhat conversion (as expected when patching a mariner image). However, I still see "dnf install busybox dnf-utils cpio -y" in the logs with Fedora, which should already have busybox?

pkg/patch/patch.go Outdated Show resolved Hide resolved
pkg/patch/patch.go Outdated Show resolved Hide resolved
MiahaCybersec and others added 2 commits August 27, 2024 16:03
Co-authored-by: Ashna Mehrotra <ashnamehrotra@gmail.com>
Signed-off-by: Miaha <143584635+MiahaCybersec@users.noreply.github.com>
Co-authored-by: Ashna Mehrotra <ashnamehrotra@gmail.com>
Signed-off-by: Miaha <143584635+MiahaCybersec@users.noreply.github.com>
@MiahaCybersec
Copy link
Contributor Author

BusyBox is not preinstalled on Fedora, but it is available in the Fedora repos. However, BusyBox is not available in the RHEL or Rocky repos.

pkg/pkgmgr/rpm.go Outdated Show resolved Hide resolved
Simplify the detection of installed package managers and required tools by using `strings.Contains` instead of splitting the applications list. This change reduces nested loops and enhances code readability while maintaining functionality for checking missing tools and package managers.

Signed-off-by: Miaha Cybersec <MiahaCybersec@gmail.com>
@MiahaCybersec
Copy link
Contributor Author

Only failing check is codecov/project - presumably a similar case to #706

@ashnamehrotra ashnamehrotra merged commit b827cb9 into project-copacetic:main Aug 30, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[REQ] support other tools in installToolsCmd for rpm tooling image
2 participants