fix: select the native package manager per Linux distribution#4773
Open
ddeskov-limechain wants to merge 2 commits into
Open
Conversation
Signed-off-by: Dian Deskov <dian.deskov@limechain.tech>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
…ls-on-Fedora-Linux
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4773 +/- ##
======================================
Coverage ? 0
======================================
Files ? 0
Lines ? 0
Branches ? 0
======================================
Hits ? 0
Misses ? 0
Partials ? 0 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request makes Solo's Linux install flow distribution-aware instead of assuming
apt-get+ Homebrew on every Linux host. Previouslysolo init/ one-shot on Linux hard-codedapt-getand bootstrapped linuxbrew to runbrew install podman— on Fedora (and any non-Debian distro) this failed immediately (apt-getabsent) and the linuxbrew bootstrap required a C compiler ("Install Clang or runbrew install gcc"), which is the exact failure reported in #4676.This pull request changes the following:
/etc/os-release(ID/ID_LIKE) and routes to the correct native package manager.LinuxPackageManagerbase plusdnf,zypper,pacman, andapkmanagers alongside the existingapt-getone; refactorsapt-getonto the base and makes every install/remove/update/upgrade command non-interactive (e.g.-y,--noconfirm,--non-interactive).OsPackageManagernow resolves the manager per-distro via/etc/os-release, with a binary-probe fallback (FALLBACK_PROBE_ORDER), and throws a clearUnsupportedLinuxDistributionSoloError(SOLO-5074) when nothing matches.PackageManagerinterface, removing thegetPackageManager() as AptGetPackageManagerdown-cast incluster-task-manager.ts.git,iptables, andpodmanon Linux via the native package manager and drops the linuxbrew bootstrap on Linux — removing the C-compiler/Homebrew dependency. macOS (VM-mode podman binary download) is unchanged.brewPackageManager/osPackageManagerinjections frominit.Behavior change to be aware of (not a contract break): on Linux the mechanism that installs podman changes from linuxbrew to the native package manager. The end state (podman installed, cluster created) is unchanged, and on the distros tested the native podman is current (see versions in the test table). On very old Ubuntu LTS the apt-provided podman could be older than what linuxbrew shipped — called out under "not tested" below.
Related Issues
Pull request (PR) checklist
UnsupportedLinuxDistributionSoloErrorfor unsupported distros, and the originalbrew installformula concern lives inhiero-ledger/homebrew-tools(tracked by fix: add recursive option to mkdir #215)package.jsonchanges have been explained to and approved by a repository manager — N/A, nopackage.jsonchangesTesting
The following manual testing was done:
1. Unit tests (real detection + command-builder code) — 33 passing, 0 failing
fedora→dnf,ubuntu→apt-get,debian→apt-get,opensuse-leap→zypper,arch→pacman,alpine→apk,rockymatched viaID_LIKE→dnf, and an unsupported distro throwsUnsupportedLinuxDistributionSoloError.--version) runs without sudo.initandcluster-task-managerunit tests still pass with the slimmed constructors.2. Static checks
npx tsc— clean (no type errors).npx eslinton all changed files — 0 errors.npx dpdm … circular:1— no circular dependencies introduced.3. Cross-platform verification on real distributions (Docker)
For each target distro I ran an ephemeral container (
docker run --rm --pull=missing -v verify.sh:/verify.sh:ro <image> sh /verify.sh). The in-container script:/etc/os-release(ID/ID_LIKE),OsPackageManager,apt-getis absent on non-Debian distros (proving the old "apt-get everywhere" path would have failed there),dnf install -y git iptables podman— andgit,iptables, andpodmanare installed and prints their versions.apt-getabsent (old bug)fedora:latestubuntu:latestopensuse/leap:latestalpine:latestmenci/archlinuxarm:base(arm64)/etc/os-release, installgit+iptables+podmannatively, and report no C compiler present or required — the gcc/clang + Homebrew failure from brew install hiero-ledger/tools/solo fails on Fedora Linux (no bottle, source build also fails) #4676 is gone.ID=archarm(Arch Linux ARM), which is not in the os-release map; Solo still correctly selectedpacmanvia the stage-2 binary-probe fallback, exercising that path on a real system.archlinux:latestunder x86-64 qemu emulation (Apple-Silicon host) and failed there due to pacman 6.1's internal seccomp sandbox being incompatible with qemu-user emulation — an environment artifact, not a Solo defect. Re-running on an arm64-native image gave a genuine PASS. The arm64 Arch community image needed base prep (pacman-key --init/--populate, pluspacman -Syuto reconcile a stalegcc-libs→libgcc/libstdc++split); this prep does not alter the command Solo emits.The following was not tested:
solo initend-to-end flow (kind cluster creation, sudo elevation, rootful podman) on a real non-Ubuntu Linux host — the Docker matrix validates distro detection and the exact native package-install commands, but not the surrounding Listr task orchestration or thesudowrapper (containers run as root).apton older Ubuntu LTS releases — on the testedubuntu:latestit is current (5.7.0), but older LTS apt repos may ship an older podman than linuxbrew did.apt-get.Commit message guidelines
We use 'Conventional Commits' to ensure that our commit messages are easy to read, follow a consistent format, and for automated release note generation. Please follow the guidelines below when writing your commit messages: