Documentation
¶
Overview ¶
Package release is the signed manifest of a release (schema 2): which hub, runtime, agent, command line tool and web page belong together, the hashes of their files, and the ranges of the extension protocols this core speaks. It is what `harnessly upgrade plan/apply` reads (docs/hub/upgrade.md).
/dl/manifest.json (files and hashes only, read by internal/selfupdate) is unchanged and stays the default way a machine follows its hub; the release manifest is a separate file, /dl/release.json, with its detached signature.
Index ¶
- Constants
- Variables
- func FileKey(component, goos, goarch string) string
- func KeyID(pub ed25519.PublicKey) string
- func ParsePrivateKey(text string) (ed25519.PrivateKey, error)
- func ParsePublicKey(text string) (ed25519.PublicKey, error)
- func Sign(priv ed25519.PrivateKey, body []byte) ([]byte, error)
- func SortedKeys[V any](m map[string]V) []string
- func Verify(pub ed25519.PublicKey, body, sigFile []byte) error
- type Component
- type Data
- type ExtensionCheck
- type File
- type Manifest
- type Range
- type Signature
- type Verdict
- type Version
Constants ¶
const ( Hub = "hub" Runtime = "runtime" Agent = "agent" CLI = "cli" UI = "ui" )
Component names. UI is part of the runtime binary (the webui build tag) and has no file of its own.
const Schema = 2
Schema is the version of this file format.
Variables ¶
Components lists the names a manifest may hold.
var ErrBadSignature = errors.New("release manifest: the signature does not match")
ErrBadSignature: the manifest is not the one the key signed.
Functions ¶
func ParsePrivateKey ¶
func ParsePrivateKey(text string) (ed25519.PrivateKey, error)
ParsePrivateKey reads a private key file (base64 of the 64 bytes), for the tool that signs a release.
func ParsePublicKey ¶
ParsePublicKey reads the pinned key file (base64 of the 32 bytes).
func Sign ¶
func Sign(priv ed25519.PrivateKey, body []byte) ([]byte, error)
Sign signs the manifest bytes.
func SortedKeys ¶
SortedKeys is a helper for stable output.
Types ¶
type Component ¶
type Component struct {
Version string `json:"version"`
// Files by download name (`runtime-linux-amd64`); empty for a part carried inside another (the UI).
Files map[string]File `json:"files,omitempty"`
// Requires: the least version of other components this one works with, by component name.
Requires map[string]string `json:"requires,omitempty"`
}
Component is one part of the release.
type Data ¶
type Data struct {
// SchemaVersion is the newest migration the hub applies.
SchemaVersion int `json:"schema_version"`
// Additive: the migrations since MinFrom only add (a table, a column); an older binary keeps working on the data.
Additive bool `json:"additive"`
// MinFrom is the oldest release this one upgrades from directly; empty means any.
MinFrom string `json:"min_from,omitempty"`
}
Data is what the release does to stored data. The binary of a release can be put back; the data it migrated cannot.
type ExtensionCheck ¶
type ExtensionCheck struct {
Name string `json:"name"`
Protocol string `json:"protocol"`
Verdict Verdict `json:"verdict"`
Detail string `json:"detail"`
}
ExtensionCheck is one line of the plan.
type Manifest ¶
type Manifest struct {
Schema int `json:"schema"`
Version string `json:"version"`
Components map[string]Component `json:"components"`
// ExtensionAPI: for each extension protocol (`harnessly.machine-provider`) the majors this core speaks.
ExtensionAPI map[string]Range `json:"extension_api,omitempty"`
Data Data `json:"data"`
}
Manifest is the file.
func (*Manifest) CheckExtension ¶
func (m *Manifest) CheckExtension(name, protocol string) ExtensionCheck
CheckExtension compares the protocol an extension is registered with to the release's ranges.
type Signature ¶
type Signature struct {
Alg string `json:"alg"`
KeyID string `json:"key_id"`
Sig string `json:"sig"`
}
Signature is the content of release.json.sig.
type Verdict ¶
type Verdict string
Verdict of one registered extension against a release.
const ( // Compatible: the release speaks the extension's protocol major. Compatible Verdict = "compatible" // Incompatible: the release speaks that protocol, but not that major. Incompatible Verdict = "incompatible" // Unknown: the release does not mention the protocol; nothing is promised either way. Unknown Verdict = "unknown" )
type Version ¶
type Version struct{ Major, Minor, Patch int }
Version is X.Y.Z.
func ParseVersion ¶
ParseVersion reads X.Y.Z (a leading v and a suffix after - or + are allowed and ignored).