Documentation
¶
Overview ¶
Package updatecheck asks versions.miabi.io, once a day, which releases of Miabi and its components exist, and caches the answer. It notifies; it never upgrades. This process holds the Docker socket and orchestrates every workspace, so restarting itself into a new image is a decision for a human with a shell — and the node agent carries the only remote path to its host, so the same is true there, more so.
One request covers every component, and each component keeps its own cached row. They differ in one way that shapes the code. The platform knows the build it is running, so its check can answer "is there anything newer than me". Agents and runners each run their own build, so there is no single current version to compare against: their check records the newest stable release and the comparison happens per node or runner, at read time.
Index ¶
Constants ¶
const ( ComponentMiabi = models.UpdateComponentMiabi ComponentAgent = models.UpdateComponentAgent ComponentRunner = models.UpdateComponentRunner ComponentGateway = models.UpdateComponentGateway )
Components checked, one cached row each. Named in models so the schema and the service agree.
const ( // IndexURL lists the current release of every component in one file. The request carries nothing // identifying beyond the User-Agent: no install id, no host, no license. IndexURL = "https://versions.miabi.io/v1/index.json" )
const MinAgentVersion = "0.4.0"
MinAgentVersion is the oldest node agent this control plane supports — the counterpart to docker.MinEngineVersion, and the threshold the Nodes page paints red.
It is 0.4.0 because that is where the agent began forwarding its node gateway's request events to the manager. Below it a node connects, deploys and reports healthy while contributing nothing to Workspace Analytics, which is the kind of gap an operator finds months later in a graph.
Bump it when a handshake or protocol change makes an older agent genuinely wrong, not merely old. It is a badge, never a gate: refusing an old agent would strand a fleet the moment Miabi upgraded.
const ReasonSecurity = "security"
ReasonSecurity marks a release the admin notice must surface prominently.
Variables ¶
This section is empty.
Functions ¶
func AgentSupported ¶ added in v1.10.5
AgentSupported reports whether an agent build is at or above MinAgentVersion. An unparseable version is not called unsupported: we do not know what it is, and guessing wrong here paints a working fleet red.
func IsNewer ¶ added in v1.4.0
IsNewer reports whether latest is a strictly newer release than current. Readers gate the notice on this rather than trusting the cached row: the row is written by a daily cron, so between an upgrade and the next tick it still describes the previous build. Comparing at read time makes offering a downgrade impossible.
Types ¶
type AgentState ¶ added in v1.10.5
type AgentState string
AgentState is how a node's agent stands against this control plane.
const ( // AgentUnknown covers a node that has never reported a version and one whose version is not a // release at all (a `dev` build, a commit sha). It renders as no badge: absence of evidence must // not read as "out of date", or a broken checker masquerades as a verdict. AgentUnknown AgentState = "" // AgentCurrent is supported and at the newest release we know of. AgentCurrent AgentState = "current" // AgentOutdated is supported, but a newer release exists. AgentOutdated AgentState = "outdated" // AgentUnsupported is below MinAgentVersion. Determined locally, so it stays true on an // air-gapped install where the release check has never once succeeded. AgentUnsupported AgentState = "unsupported" )
func ClassifyAgent ¶ added in v1.10.5
func ClassifyAgent(current, latest string) AgentState
ClassifyAgent places a node's agent against the floor and the newest known release. latest may be empty — an install that cannot reach versions.miabi.io still gets the unsupported verdict, which is the one that matters and the one that needs no network.
type Channels ¶ added in v1.10.19
type Channels struct {
Stable *Release `json:"stable,omitempty"`
Prerelease *Release `json:"prerelease,omitempty"`
}
Channels is a component's current releases. Prerelease is offered only to a build that is itself one.
type Checker ¶ added in v1.10.19
type Checker struct {
// contains filtered or unexported fields
}
Checker fetches the index once and updates every component's row from it.
func NewChecker ¶ added in v1.10.19
NewChecker builds the daily check for the given components. version is the running build, sent as the User-Agent.
type Release ¶
type Release struct {
Version string `json:"version"`
ReleasedAt time.Time `json:"released_at"`
ReleaseURL string `json:"release_url"`
ChangelogURL string `json:"changelog_url,omitempty"`
Reason string `json:"reason"`
}
Release is one channel entry of versions.miabi.io.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reads and writes one component's cached row.
func NewAgentService ¶ added in v1.10.5
NewAgentService builds the cache for the node agent.
func NewComponentService ¶ added in v1.10.19
NewComponentService builds the cache for a component this process does not run (agent, runner, gateway).
func NewService ¶
NewService builds the cache for Miabi's own release.
func (*Service) Dismiss ¶
Dismiss silences the notice for a specific version. Recording the version — rather than a boolean — means the next release notifies again.
func (*Service) Enabled ¶
Enabled reports whether checks run at all. A `dev` build never checks its own component: its version does not compare meaningfully against any release. A component this process does not run carries no version and is gated on the setting alone.
func (*Service) LatestVersion ¶ added in v1.10.5
LatestVersion returns the newest release recorded for this component, or "" when the check has never succeeded. One indexed row: cheap enough to read per request rather than cached in memory, where it would go stale against the cron that writes it.