Documentation
¶
Overview ¶
Package update checks for and installs Volcano CLI releases.
Index ¶
- func NewerThan(candidate, current string) (bool, error)
- func PlatformBinaryName() (string, error)
- func Upgrade(ctx context.Context, current string, out io.Writer, opts Options) error
- func UpgradeCommandFor(m InstallMethod) (name string, args []string, managed bool)
- type CommandRunner
- type HTTPClient
- type InstallMethod
- type Options
- type Release
- type RunnerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlatformBinaryName ¶
PlatformBinaryName returns the published release asset name for this process.
func Upgrade ¶
Upgrade upgrades the CLI. It delegates to the package manager the CLI was installed with (npm, brew, …); for script/manual installs it downloads the latest release and replaces the running binary in place.
func UpgradeCommandFor ¶ added in v0.3.0
func UpgradeCommandFor(m InstallMethod) (name string, args []string, managed bool)
UpgradeCommandFor maps an install method to the package-manager command that upgrades the CLI. managed is false for installs (script/manual/unknown) that `volcano upgrade` handles itself by replacing the binary in place.
Types ¶
type CommandRunner ¶
type CommandRunner interface {
Run(ctx context.Context, name string, args ...string) ([]byte, error)
}
CommandRunner runs an external verification command.
type HTTPClient ¶
HTTPClient is the subset of http.Client used by release checks and upgrades.
type InstallMethod ¶ added in v0.3.0
type InstallMethod string
InstallMethod identifies how the running CLI was installed, which decides how `volcano upgrade` upgrades it: delegate to the package manager (npm, brew, …) or replace the binary in place (script/manual installs).
const ( InstallNPM InstallMethod = "npm" InstallPNPM InstallMethod = "pnpm" InstallYarn InstallMethod = "yarn" InstallBun InstallMethod = "bun" InstallBrew InstallMethod = "brew" InstallScript InstallMethod = "script" InstallUnknown InstallMethod = "" )
Install method identifiers. InstallUnknown ("") means "not determined"; callers treat it like a script/manual install (self-replace).
func DetectInstallMethod ¶ added in v0.3.0
func DetectInstallMethod(exePath string) InstallMethod
DetectInstallMethod reports how the CLI at exePath was installed, preferring a marker file written at install time and falling back to the executable path.
type Options ¶
type Options struct {
HTTPClient HTTPClient
DownloadURL string
ExecutablePath string
CommandRunner CommandRunner
RequireSignatureVerification bool
// InstallMethod overrides auto-detection of how the CLI was installed.
// Empty means detect from the marker file / executable path.
InstallMethod InstallMethod
// ManagerRunner runs a package-manager upgrade command (npm/brew/…),
// streaming output to the writer passed to Upgrade. Nil uses os/exec with
// inherited stdio.
ManagerRunner func(ctx context.Context, out io.Writer, name string, args ...string) error
// LookPath resolves a command name to a path. Nil uses exec.LookPath.
LookPath func(name string) (string, error)
}
Options configures update operations.
type Release ¶
type Release struct {
TagName string
// contains filtered or unexported fields
}
Release is a published CLI version on Volcano downloads.
func LatestRelease ¶
LatestRelease resolves the promoted release from Volcano downloads.