Skip to content

fix(cli): skip reinstall in rill upgrade when already on latest version - #9985

Merged
k-anshul merged 7 commits into
rilldata:mainfrom
vinay121314:fix/upgrade-skip-current-version
Oct 6, 2026
Merged

k-anshul merged 7 commits into
rilldata:mainfrom
vinay121314:fix/upgrade-skip-current-version

Conversation

@vinay121314

@vinay121314 vinay121314 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9984.

rill upgrade (with no flags) always ran the install script, so it re-downloaded the same release even when the CLI was already on the latest version.

Changes

  • Before installing, compare the running CLI version with the latest GitHub release (via the existing Helper.LatestVersion, cached for 24h). If the current version is >= latest, print Rill is already up to date (vX.Y.Z). Use --force to reinstall. and exit.
  • Add a --force flag to reinstall anyway.
  • --version and --nightly behaviour is unchanged. Dev builds (empty version) and version-lookup errors fall back to the previous behaviour (install).
  • Extract the comparison into versionUpToDate and add table-driven unit tests in cli/cmd/upgrade/upgrade_test.go (equal, older, newer, prerelease, and invalid version cases).

Checklist:

  • Covered by tests
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes

Comment thread cli/cmd/upgrade/upgrade.go Outdated
return false, "", nil
}

latest, err := ch.LatestVersion(cmd.Context())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ch.LatestVersion can fetch cached version which means rill upgrade can fail if a new version is released but user's cached version is used.
If we want to fix this then we can take the route of always refetching version in rill upgrade but that adds extra latency.
It can be mitigated to some extent by ensuring latest version is refetched only when current version and cached version are same but that adds more complexity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks! I went with your second suggestion. The cached version is now only trusted when it says an upgrade is needed. If the cache says we're already on the latest, rill upgrade fetches the latest release from GitHub again before skipping. So a stale cache can't block an upgrade, and there's no extra latency when an upgrade is actually available. I added a small RefreshLatestVersion helper in cmdutil for this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey

Your last change pushed a compile error.
On deeper reflection I realised it is simpler and better to move the check to install script.
Instead of sending it for another round I made changes as part of this PR itself.

@k-anshul
k-anshul requested a review from nishantmonu51 October 6, 2026 08:04
@k-anshul

k-anshul commented Oct 6, 2026

Copy link
Copy Markdown
Member

Verified offline. Test failures can be ignored.

@k-anshul
k-anshul merged commit dcb1955 into rilldata:main Oct 6, 2026
11 of 14 checks passed
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.

Upgrade updates current version

3 participants