Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyChecksum ¶
VerifyChecksum checks the SHA256 of archivePath against the checksums file.
Types ¶
type Config ¶
type Config struct {
CheckInterval time.Duration
Repo string // "owner/repo"
InstallDir string
Version string // updater's own version (used for user-agent)
// PinnedVersion locks the updater to a specific release tag
// (e.g. "v1.10.5"). When set, the updater installs exactly that
// version — regardless of whether it is newer, older, or already
// current — and will not chase the latest release. An empty
// string (default) preserves the existing "always follow latest"
// behaviour. Set to an empty string to un-pin and resume
// auto-updating to the latest stable.
PinnedVersion string
// SkipAttestation disables SLSA attestation verification of
// checksums.txt. This is the ONLY way to bypass attestation: when
// false (the default) and the gh CLI is absent, verification fails
// closed and the update is refused. Intended for test environments
// where the test repos do not have real attestations. Leaving it
// false in production keeps provenance verification mandatory.
// The SHA256 checksums.txt match is always enforced regardless of
// this flag.
SkipAttestation bool
// StatePath, when non-empty, points to a JSON control file
// {"enabled": bool} that gates the AUTOMATIC update loop and is
// re-read on every tick. When the file is absent or {"enabled":
// false} the loop performs NO updates — so any deployment that sets
// StatePath is OFF BY DEFAULT until explicitly enabled (e.g. via
// `pilotctl update enable`). A manual one-shot RunOnce always runs,
// ignoring this gate. An empty StatePath preserves the legacy
// always-on loop behaviour for backward compatibility.
StatePath string
}
Config holds the updater configuration.
type GitHubAsset ¶
type GitHubAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
GitHubAsset represents a release asset.
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Assets []GitHubAsset `json:"assets"`
}
GitHubRelease represents a subset of the GitHub release API response.
type Semver ¶
Semver represents a parsed semantic version.
func ParseSemver ¶
ParseSemver parses a version string like "v1.2.3" or "1.2.3" or "v1.2.3-dirty". It strips the "v" prefix and any suffix after a hyphen.
type Service ¶
type Service struct{}
Service is the L11 plugin lifecycle adapter for the updater. The daemon does not register this today — cmd/updater is a standalone binary that uses updater.New / *Updater.Start directly. The adapter exists so the plugin package conforms to the L10 Service contract and so the no_updater build tag has a meaningful counterpart (see service_disabled.go).
When this plugin is eventually wired into cmd/daemon's plugin runtime, this Service will own the *Updater lifecycle. Today its Start/Stop are no-ops; it is registered nowhere.
func NewService ¶
func NewService() *Service
NewService returns a Service ready for daemon.RegisterPlugin (when cmd/daemon eventually starts registering it). Distinct from updater.New, which constructs the standalone *Updater used by cmd/updater.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater periodically checks GitHub Releases for new versions and optionally applies them.
func (*Updater) RunOnce ¶ added in v0.2.2
func (u *Updater) RunOnce()
RunOnce runs the update check once synchronously and returns. Unlike Start, it does not enter a periodic loop — it performs a single check (checking the pinned version or latest release), applies the update if available, and returns. Useful for one-shot invocations from `pilotctl update` and similar CLI commands. It ALWAYS runs — the StatePath enabled-gate applies only to the automatic loop, so a manual `pilotctl update` works even when auto-update is disabled.