update

package
v0.175.0-rc.113 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package update replaces the running beekeeper with the latest signed release.

Index

Constants

View Source
const Repository = "giantswarm/beekeeper"

Repository is the GitHub repository whose releases carry the binaries: beekeeper-<os>-<arch> (beekeeper-windows-<arch>.exe), each next to its cosign Sigstore bundle (<asset>.bundle), which the download is verified against before anything is written.

Variables

View Source
var ErrOutdated = errors.New("a newer beekeeper release is available")

ErrOutdated is what a check returns when a newer release exists.

Functions

func WithOptions

func WithOptions(ctx context.Context, opts Options) context.Context

WithOptions attaches opts to ctx for Run.

Types

type Asset

type Asset struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Size int    `json:"size"`
	// URL is the asset's public download URL.
	URL string `json:"url"`
}

Asset is one binary or bundle of a Release.

type Canary

type Canary func(ctx context.Context, path, version string) error

Canary checks a verified candidate binary at path for version before it replaces the installed executable. Returning an error keeps the current executable in place.

type Options

type Options struct {
	Canary Canary
	Skip   func(tag string) bool
}

Options configures a Run call through its context.

func OptionsFrom

func OptionsFrom(ctx context.Context) Options

OptionsFrom returns the Options attached to ctx.

type Release

type Release struct {
	Tag        string    `json:"tag"`
	ID         int64     `json:"id"`
	URL        string    `json:"url"`
	Published  time.Time `json:"published"`
	Prerelease bool      `json:"prerelease"`
	Assets     []Asset   `json:"assets"`
}

Release is one release of Repository as an authenticated lookup found it: what an execution host needs to install it without asking GitHub's API itself. Its assets are downloaded from their public download URLs, which GitHub's API rate limits do not cover, and verified against their bundles on the host as any download is.

func LookupVersion

func LookupVersion(ctx context.Context, version string) (Release, error)

LookupVersion looks up release version (a tag, "v0.3.0") of Repository with the gh login (or GH_TOKEN, GITHUB_TOKEN), never anonymously, so that the call counts in the person's budget like every other GitHub call of beekeeper. A coordinator hands the answer to the execution host it updates (InstallRelease).

type Result

type Result struct {
	Current   string    `json:"current"`
	Latest    string    `json:"latest"`
	Published time.Time `json:"published"`
	URL       string    `json:"url"`
	Newer     bool      `json:"newer"`
	// Path is the file the update replaced, symbolic links not resolved.
	Path    string `json:"path,omitempty"`
	Updated bool   `json:"updated"`
}

Result is what a check or an update found and did.

func InstallRelease

func InstallRelease(ctx context.Context, w io.Writer, rel Release) (Result, error)

InstallRelease installs rel, as a coordinator's LookupVersion found it, over the running executable once its bundle verifies, as InstallVersion does, without asking GitHub's API: the binary and its bundle come from their public download URLs under the release's tag.

func InstallVersion

func InstallVersion(ctx context.Context, w io.Writer, version string) (Result, error)

InstallVersion installs exactly the release version (a tag, "v0.3.0") over the running executable once its bundle verifies, as Run installs the latest: an execution host follows its coordinator's release, never a newer one. The verified download is staged beside the destination and renamed over it atomically, with no backup or ownership-dependent hard link.

func Run

func Run(ctx context.Context, w io.Writer, checkOnly bool) (Result, error)

Run looks up the latest release and, unless checkOnly, installs its binary for this OS and architecture over the running executable once its bundle verifies. A running pre-release looks among the pre-releases too, a running release only among releases. Progress goes to w. With checkOnly the error is ErrOutdated when a newer release exists.

The binary is renamed over the executable in one step, symbolic links resolved: a beekeeper watch that runs keeps running the old binary, every process started afterwards runs the new one, and several updates may run at once. A development build, a release without a bundle for this platform's binary and a download that does not verify are refused, and the executable stays as it is.

Jump to

Keyboard shortcuts

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