Remove unneeded packages from the Collector image.#2970
Remove unneeded packages from the Collector image.#2970
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2970 +/- ##
=======================================
Coverage 27.38% 27.38%
=======================================
Files 95 95
Lines 5427 5427
Branches 2548 2548
=======================================
Hits 1486 1486
Misses 3214 3214
Partials 727 727
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
2d2880a to
8fdac91
Compare
8fdac91 to
8ada533
Compare
They are rpm dependencies downstream, but not upstream.
a02e575 to
9ab7fd2
Compare
| microdnf -y clean all && \ | ||
| rpm --verbose -e --nodeps $(rpm -qa 'curl' '*rpm*' '*dnf*' '*libsolv*' '*hawkey*' 'yum*' 'libyaml*' 'libarchive*') && \ | ||
| rm -rf /var/cache/dnf /var/cache/yum | ||
| rpm --verbose -e --nodeps $(rpm -qa $(/orphaner bash curl elfutils-libelf tbb c-ares openssl-libs libcap-ng libuuid libstdc++ libcurl-minimal)) && \ |
There was a problem hiding this comment.
This is a notable effort, but I have to tell there's another way. Instead of starting from ubi-minimal and removing packages, you can start from ubi-micro which is much slimmer base (it can't get any slimmer for the time being) and install only necessary packages.
It's a tiny bit involved how to install RPMs into ubi-micro, but solvable. Would you be interested to try that out?
Description
Our base image contains some packages that are not needed by Collector. This PR introduces 'orphaner', a tool able to use the RPM dependency graph to list all packages that are not part of Collector deps. Then we uninstall them.
We don't use the available python/perl tools because they have dependencies themselves.
'orphaner' uses only librpm.
Checklist
Automated testing
Testing done
With this change, on ubi9, the Collector image archive decreases size from 106MB to 92MB.
Notable libraries going away: