Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Stamp ¶
func Stamp() string
Stamp is the version `just agent-dist` stamped into these binaries, or "" when none have been built into this server.
It exists because nothing else can answer the question. The version is applied with `-X main.version`, which is only readable by executing the binary, and embed.FS carries no modification times — so a server has no way to tell whether the agents it is about to install came from its own source or from whatever was last cross-compiled into the tree.
That is not hypothetical. The dist directory is gitignored and produced by one recipe that nothing depends on, so editing agent code and running the server ships the previous build with no warning at all. A change that made a dist-upgrade stop requiring a Proxmox token was committed at 18:24 and was still missing from every host onboarded hours afterwards, because the binaries were built at 17:24.
func WarnIfStale ¶
WarnIfStale reports a mismatch between the embedded agents and this server.
A warning rather than a refusal: agents built from a different commit are usually a developer mid-change, and refusing to start would make the common case worse than the problem. What matters is that it is SAID — the failure this prevents is silent, and costs its whole diagnosis before anyone thinks to check a build artefact.
Empty stamp means no agents are embedded at all, which Catalogue already reports usefully at the point an upgrade is attempted; saying it again at every startup would train people to ignore this line.
Types ¶
type Build ¶
type Build struct {
OS string `json:"os"`
Arch string `json:"arch"`
Size int64 `json:"size"`
// SHA256 is what the agent verifies the download against before it installs
// anything. Without it an upgrade is "execute whatever arrived", and a
// truncated download is a binary that either fails to start or, worse,
// starts.
SHA256 string `json:"sha256"`
}
Build is one downloadable binary.
type Dist ¶
type Dist struct {
// Version is the control plane's own version, which is what these binaries
// were built alongside. An agent compares its own against it.
//
// Deliberately the SERVER's version rather than one read out of the binary:
// the two ship together from one release, and parsing a version back out of
// an executable is guesswork that fails silently.
Version string `json:"version"`
Builds []Build `json:"builds"`
}
Dist is the catalogue an agent reads to decide whether to upgrade.