release

package
v0.16.521 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
const Schema = 2

Schema is the version of this file format.

Variables

View Source
var Components = []string{Hub, Runtime, Agent, CLI, UI}

Components lists the names a manifest may hold.

View Source
var ErrBadSignature = errors.New("release manifest: the signature does not match")

ErrBadSignature: the manifest is not the one the key signed.

Functions

func FileKey

func FileKey(component, goos, goarch string) string

FileKey is the download name of a component for a platform.

func KeyID

func KeyID(pub ed25519.PublicKey) string

KeyID names a public key.

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

func ParsePublicKey(text string) (ed25519.PublicKey, error)

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

func SortedKeys[V any](m map[string]V) []string

SortedKeys is a helper for stable output.

func Verify

func Verify(pub ed25519.PublicKey, body, sigFile []byte) error

Verify checks the manifest bytes against the signature file and the pinned key.

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 File

type File struct {
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

File is one downloadable file.

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 Parse

func Parse(body []byte) (*Manifest, error)

Parse reads and validates a manifest.

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.

func (*Manifest) Names

func (m *Manifest) Names() []string

Names returns the component names of the manifest, in a fixed order.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks the manifest is whole and that its parts agree with each other.

type Range

type Range struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

Range is the extension protocol majors this core speaks, both ends included.

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

func ParseVersion(s string) (Version, bool)

ParseVersion reads X.Y.Z (a leading v and a suffix after - or + are allowed and ignored).

func (Version) Less

func (v Version) Less(o Version) bool

Less reports v < o.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL