update

package
v0.46.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package update checks for and installs Volcano CLI releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewerThan

func NewerThan(candidate, current string) (bool, error)

NewerThan reports whether candidate is newer than current.

func PlatformBinaryName

func PlatformBinaryName() (string, error)

PlatformBinaryName returns the published release asset name for this process.

func Upgrade

func Upgrade(ctx context.Context, current string, out io.Writer, opts Options) error

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

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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

func LatestRelease(ctx context.Context, opts Options) (*Release, error)

LatestRelease resolves the promoted release from Volcano downloads.

func (Release) AssetURL added in v0.37.3

func (r Release) AssetURL(name string) string

AssetURL returns the download URL of a named asset in this release.

type RunnerFunc

type RunnerFunc func(ctx context.Context, name string, args ...string) ([]byte, error)

RunnerFunc adapts a function to CommandRunner.

func (RunnerFunc) Run

func (f RunnerFunc) Run(ctx context.Context, name string, args ...string) ([]byte, error)

Run calls f(ctx, name, args...).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL