Repository navigation
fix(installer): upgrade the CLI when its package is already installed - #317
Conversation
Re-running the installer is the documented way to upgrade an install made with it, but on dnf and apk systems it left an installed package at its old version. - yum/dnf: expire the metadata cache, then run `yum install` and `yum upgrade` for the CLI package only. `dnf install` (Fedora) reports "already installed" instead of upgrading. - apk: add `--upgrade` to `apk add`, which otherwise keeps the installed version. - apt already upgrades with `apt-get update` and `apt-get install`. The installer tests (local script and workflow) gain an upgrade case per package manager: install the 5.16.0 release package, run the installer, and check that the version changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Reviewed — No blocking findings · 🔵 2 minor points
🔍 Full review · 3 files reviewed
🔵 Minor points
.github/workflows/test-installer.yml:110— The upgrade check only asserts thatupsun --versionis not exactlyUpsun CLI 5.16.0. The "Install an older release" step (line 97) prints the old version but never checks it. So if the old package reports anything else, the test passes even when no upgrade happened. Examples: avprefix, a dev or VCS-derived version, or a different application name. The same gap is inscripts/test/installer.shline 61, where the old binary's version is never checked either. A futureOLD_VERSIONbump to a release whose string differs would turn the test into a no-op without anyone noticing.installer.sh:705—yum clean expire-cacheexpires the metadata of every enabled repository, not justupsun. The followingyum installthen downloads metadata for all of them again, which on Fedora means tens of MB of base and updates repodata. Each re-run of the installer pays this cost, even though only the CLI package's metadata needs refreshing. Running the cleanup asyum clean expire-cache --disablerepo='*' --enablerepo=upsunwould refresh only the CLI repository.
Verification
- In the yum path, the three
call_rootcommands are chained with||, so a failure in any of them reaches the same error exit as before. apk add --upgrade --update-cache $packagekeeps the existing--update-cache, and only adds--upgradeso an installedupsun-cliis updated.upsun --versionprints<Application.Name> <Version>viaversionCommand, and fatih/color drops the cyan escape when stdout is captured by$(...). So the comparison stringUpsun CLI 5.16.0matches the real format.- In scripts/test/installer.sh,
checkis reset to an empty string after the upgrade cases, so the raw test falls back toupsun --version.
The PR adds the linux-upgrade matrix job to the test-installer workflow (debian, fedora:41 and alpine:3.21 upgrading from v5.16.0) and matching upgrade cases to scripts/test/installer.sh. The workflow triggers only on changes to installer.sh or the workflow file. The yum 3 and dnf5 behaviour shown in the PR's table is not covered by CI.
Review details
- Commit: b7e92f2
- Model: claude-opus-5-5
Review 1 of 10 for this pull request · View the full run
CLI buildsBuilt from c1cf9d1 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.
Or download one with the GitHub CLI, e.g.: gh run download 44104147343 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --versionOn macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: |
`yum clean expire-cache` expired the metadata of every repository, so each re-run downloaded it all again. Pass `--setopt=upsun.metadata_expire=0` to the install and upgrade commands instead: yum 3, dnf4 and dnf5 then refresh only the upsun repository. (`clean` with `--disablerepo='*' --enablerepo=upsun` is scoped on yum 3, but not on dnf4 or dnf5.) The upgrade tests also check that the older release is installed before the installer runs, so they cannot pass without an upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README says installs made with the installer are upgraded by re-running it. On dnf and apk systems, the installer left an installed
upsun-clipackage at its old version.Changes
yum installand thenyum upgradeforupsun-cli, both with--setopt=upsun.metadata_expire=0.dnf installon Fedora reports "already installed. Nothing to do." instead of upgrading, and without the option a new release can be missed while cached metadata is valid. The option refreshes only the upsun repository's metadata (checked on yum 3, dnf4 and dnf5), and only the CLI package is upgraded.apk add --upgrade --update-cache upsun-cli. Without--upgrade,apk addkeeps the installed version.apt-get updatethenapt-get install -yalready upgrades.scripts/test/installer.shand thetest-installerworkflow (linux-upgrade): install the v5.16.0 release package, run the installer, and check the old version, run the installer, and check that the version changed.Container evidence
Installed 5.17.0 with the installer, downgraded to 5.16.0 (for apk: installed the v5.16.0 release
.apk), then re-ran the installer:mainFresh installs succeed on all of these images.
scripts/test/installer.sh: 7/7 pass on this branch; onmainthe fedora:41 and alpine:3.21 upgrade cases fail.🤖 Generated with Claude Code