update

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 18 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 installs the latest release over the running binary.

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

Asset is a downloadable GitHub release asset.

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 Options

type Options struct {
	HTTPClient                   HTTPClient
	GitHubAPIURL                 string
	ExecutablePath               string
	CommandRunner                CommandRunner
	RequireSignatureVerification bool
}

Options configures update operations.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

Release is the subset of GitHub release metadata the CLI needs.

func LatestRelease

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

LatestRelease fetches GitHub's latest release metadata.

func (Release) Asset

func (r Release) Asset(name string) (Asset, error)

Asset returns the release asset with name.

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