Skip to content

feat(ENG-14145): self-update command and background update check - #419

Draft
tigh-latte wants to merge 8 commits into
masterfrom
tigh/feat/update
Draft

tigh-latte wants to merge 8 commits into
masterfrom
tigh/feat/update

Conversation

@tigh-latte

Copy link
Copy Markdown
Contributor

Summary

Adds a cloudsmith update command for self-updating standalone binary installs, plus a non-intrusive background check that notifies users when a newer version is available.

Changes

  • update command (cli/commands/update.py): self-updates the standalone binary installation. Reads the release manifest, downloads and replaces target files in place (per-file replace rather than swapping the whole install dir, so user files in the install dir are preserved). Handles Windows update quirks.
  • Background update check (core/update_check.py): probes for the latest version of the host's own platform/arch (previously always probed linux-x86_64-gnu). Uses a non-configurable manifest URL. Tracks a second "last notified" timestamp so a notification can be suppressed until a later run (e.g. when running in JSON mode).
  • Install detection (core/installation.py): detects how the CLI was installed to decide whether self-update applies.
  • Self-update engine (core/self_update.py): download/verify/replace logic.
  • Config plumbing in cli/config.py + data/config.ini, and wiring into main.py / registry.py / utils.py.

Tests

New unit tests for the update command, self-update engine, installation detection, background check, and main-group integration.

Notes

Tracking: ENG-14145

to allow for a check when running in json or something, and a notification to be
suppressed until later in a future run
- fix windows update
- fix in-place downloads
Previous implementation of the in-place update replaced the whole cloudsmith install dir
with the exploded update dir, which would delete any user files in that dir.

Instead, we read the manifest and target files for replacement.
remove config via env var for the manifest url
The background check was always checking linux-x86_64-gnu regardless of platform/arch.
We will now probe for the latest version of the host's own platform.
The TestMainUpdateNotice tests rely on the update check actually running,
but update_check_disabled() short-circuits when $CI is set (as it is in
GitHub Actions). Clear CI and CLOUDSMITH_NO_UPDATE_CHECK in the state_file
fixture so the notice logic under test runs regardless of environment.
Comment thread cloudsmith_cli/cli/commands/update.py
Address PR review: surface a 'See what's changed' link so users know what
they gain by upgrading. installation.changelog_url() points at the target
version's GitHub release page (tagged v<version>), which renders that
version's changelog; it falls back to the releases list when no version is
known.

Wired into the background update notice and both the package-managed and
Windows manual-update paths of `cloudsmith update` (text + JSON, via a new
changelog_url field).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants