Documentation
¶
Overview ¶
Package updatecheck tells a Beacon app whether a newer image of it has been published.
The same file lives in pilot, prism, haul and pulse (internal/updatecheck); change it in all four together.
Beacon images are published from main: every push that passes CI pushes ghcr.io/beacon-stack/<app>:latest, built with the commit as its version. So for a commit version, "newer" means: the latest successful CI run on main is a later commit than the one running. GitHub's compare API says how many commits behind, and which. A release-tag version (v1.2.3) is compared with the latest GitHub release instead, and a build with no version (a local "dev" build) says it can't tell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
Repo string // "beacon-stack/prism"
Workflow string // the workflow that publishes images; default "ci.yml"
Branch string // default "main"
UserAgent string // e.g. "Prism/<version>"
Client *http.Client
BaseURL string // default "https://api.github.com"; tests override
CacheFor time.Duration // default 5 minutes; GitHub allows 60 unauthenticated calls an hour
// contains filtered or unexported fields
}
Checker checks one repository.
type UpdateCommit ¶
type UpdateCommit struct {
SHA string `json:"sha"` // short
Subject string `json:"subject"`
URL string `json:"url"`
}
UpdateCommit is one change in a newer build.
type UpdateStatus ¶
type UpdateStatus struct {
UpdateAvailable bool `json:"update_available"`
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
ReleaseURL string `json:"release_url,omitempty"` // compare or release page
ReleaseNotes string `json:"release_notes,omitempty"` // a release's notes (plain text)
PublishedAt string `json:"published_at,omitempty"` // when the newer build was published
Behind int `json:"behind,omitempty"` // commits behind, for commit versions
Commits []UpdateCommit `json:"commits,omitempty"` // the newer commits, newest first
Message string `json:"message,omitempty"` // why it can't tell, when it can't
}
UpdateStatus is the response of GET /api/v1/system/updates.