Documentation
¶
Overview ¶
Package update replaces the running beekeeper with the latest signed release.
Index ¶
Constants ¶
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 ¶
var ErrOutdated = errors.New("a newer beekeeper release is available")
ErrOutdated is what a check returns when a newer release exists.
Functions ¶
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 ¶
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 ¶
Options configures a Run call through its context.
func OptionsFrom ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.