Disable self-upgrade and version check for packaged installation#887
Disable self-upgrade and version check for packaged installation#887gvnnn wants to merge 2 commits into
Conversation
WalkthroughManaged install detection is added to osdctl. A new ChangesManaged Install Detection and Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When osdctl is installed via COPR or Homebrew, the self-upgrade command would overwrite a file owned by the package manager and the version-check nag is unhelpful. This adds a build-time InstallMethod variable (set via ldflags) that disables both behaviors and directs users to their package manager instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/upgrade.go`:
- Around line 29-33: When utils.IsManagedInstall() is true, the current message
may print an empty command if utils.UpgradeInstruction() returns an
unmapped/non-empty InstallMethod but no instruction; update the branch around
utils.IsManagedInstall() so you compute a non-empty fallback before formatting:
call utils.UpgradeInstruction(), and if it returns an empty string, set a
fallback string that uses utils.InstallMethod (e.g., "use your system package
manager or contact your administrator for upgrade instructions for
<InstallMethod>") and then pass that fallback into fmt.Fprintf so the user never
sees an empty upgrade instruction; adjust the code that currently references
utils.InstallMethod and utils.UpgradeInstruction() accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: bb223b60-1a67-4d0f-af45-de88075fe7ed
📒 Files selected for processing (8)
cmd/cmd.gocmd/upgrade.gocmd/upgrade_test.gocmd/version.gohack/copr.shhack/osdctl.specpkg/utils/version.gopkg/utils/version_test.go
UpgradeInstruction() now returns an error for unrecognized InstallMethod values, surfacing build misconfigurations instead of printing an empty upgrade instruction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gvnnn, MateSaary The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/test build format |
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@gvnnn: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
When osdctl is installed via COPR or Homebrew, the self-upgrade command would overwrite a file owned by the package manager and the version-check nag is unhelpful. This adds a build-time InstallMethod variable (set via ldflags) that disables both behaviors and directs users to their package manager instead.