Skip to content

fix(installer): upgrade the CLI when its package is already installed - #317

Merged
pjcdawkins merged 2 commits into
mainfrom
fix/installer-upgrade-packages
Nov 17, 2026
Merged

pjcdawkins merged 2 commits into
mainfrom
fix/installer-upgrade-packages

Conversation

@pjcdawkins

@pjcdawkins pjcdawkins commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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-cli package at its old version.

Changes

  • yum/dnf: yum install and then yum upgrade for upsun-cli, both with --setopt=upsun.metadata_expire=0. dnf install on 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: apk add --upgrade --update-cache upsun-cli. Without --upgrade, apk add keeps the installed version.
  • apt: unchanged; apt-get update then apt-get install -y already upgrades.
  • Tests: an upgrade case per package manager in scripts/test/installer.sh and the test-installer workflow (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:

Image Package manager main This branch
debian:bookworm apt 5.17.0 5.17.0
fedora:40 dnf4 5.16.0 ("already installed") 5.17.0
fedora:43 dnf5 5.16.0 5.17.0
rockylinux:9 dnf4 5.17.0 5.17.0
centos:7 (vault repos) yum 3 5.17.0 5.17.0
alpine:3.18.0 apk 5.16.0 5.17.0
alpine:3.21 apk 5.16.0 5.17.0

Fresh installs succeed on all of these images. scripts/test/installer.sh: 7/7 pass on this branch; on main the fedora:41 and alpine:3.21 upgrade cases fail.

🤖 Generated with Claude Code

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>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 that upsun --version is not exactly Upsun 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: a v prefix, a dev or VCS-derived version, or a different application name. The same gap is in scripts/test/installer.sh line 61, where the old binary's version is never checked either. A future OLD_VERSION bump to a release whose string differs would turn the test into a no-op without anyone noticing.
  • installer.sh:705 — yum clean expire-cache expires the metadata of every enabled repository, not just upsun. The following yum install then 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 as yum clean expire-cache --disablerepo='*' --enablerepo=upsun would refresh only the CLI repository.
Verification
  • In the yum path, the three call_root commands are chained with ||, so a failure in any of them reaches the same error exit as before.
  • apk add --upgrade --update-cache $package keeps the existing --update-cache, and only adds --upgrade so an installed upsun-cli is updated.
  • upsun --version prints &lt;Application.Name> &lt;Version> via versionCommand, and fatih/color drops the cyan escape when stdout is captured by $(...). So the comparison string Upsun CLI 5.16.0 matches the real format.
  • In scripts/test/installer.sh, check is reset to an empty string after the upgrade cases, so the raw test falls back to upsun --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

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

CLI builds

Built from c1cf9d1 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.

Platform Download
linux-amd64 cli-linux-amd64
linux-arm64 cli-linux-arm64
darwin-amd64 cli-darwin-amd64
darwin-arm64 cli-darwin-arm64
windows-amd64 cli-windows-amd64

Or download one with the GitHub CLI, e.g.:

gh run download 44104147343 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --version

On macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: xattr -d com.apple.quarantine upsun.

`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>
@pjcdawkins
pjcdawkins merged commit e1ba627 into main Nov 17, 2026
23 checks passed
@pjcdawkins
pjcdawkins deleted the fix/installer-upgrade-packages branch November 17, 2026 14:58
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.

1 participant