toolversions

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package toolversions reads a tool versions list (stock/tool-versions.yaml, shipped as a tool versions update) and owns the one a process uses: Versions answers its current list as an immutable Snapshot, the images AppTown runs for itself among it (the shell guidance checks run in, the df behind disk reads, the static server of release images, the private Docker daemon). apptownd and apptown-worker fill it at start from the update shipped beside them; owners take it, or the narrow Source, and each unit of work takes one Snapshot at its start. Nothing is compiled in and nothing is global.

Index

Constants

View Source
const (
	ToolSh            = "apptown-sh"
	ToolDF            = "apptown-df"
	ToolStaticServer  = "static-server"
	ToolPrivateDocker = "private-docker"
)

The runtime tools and the line this build runs of each. A line is the build's choice; the list says what it means exactly.

Variables

This section is empty.

Functions

func ShippedDir

func ShippedDir(dir string) (string, error)

ShippedDir is where a process finds the updates its release shipped: dir when given (-shipped), else stockupdate.Dir of its own executable.

Types

type Entry

type Entry struct {
	Version   string            `yaml:"version"`
	Label     string            `yaml:"label,omitempty"`
	Images    map[string]string `yaml:"images,omitempty"`
	EndOfLife string            `yaml:"endOfLife,omitempty"`
}

Entry is what one line names exactly.

type Images

type Images struct {
	Sh, DF, StaticServer, PrivateDocker string
}

Images is the set of runtime images.

type List

type List struct {
	Tools map[string]map[string]Entry `yaml:"tools"`
}

List is a tool versions list: tool → line → entry.

func Parse

func Parse(raw []byte) (*List, error)

Parse reads a tool versions document and validates it: every entry has an exact version, and every image names a digest.

func (*List) HasLine

func (l *List) HasLine(tool, line string) bool

HasLine says whether the list names tool at line.

func (*List) HasTool

func (l *List) HasTool(tool string) bool

HasTool says whether the list names tool at any line: the tools a check's appliesTo may name.

func (*List) Images

func (l *List) Images() (Images, error)

Images reads the runtime images from the list: each runtime tool at this build's line, its run image.

type Snapshot

type Snapshot struct {
	Name, Digest string
	Images       Images
	// contains filtered or unexported fields
}

Snapshot is one tool versions list as a unit of work uses it: the list, its runtime images and its identity, the update's name and the digest of what was read. It is never changed after it is made.

func NewSnapshot

func NewSnapshot(name string, raw []byte) (Snapshot, error)

NewSnapshot validates a list's document and makes its snapshot, named name; the digest is of raw.

func Shipped

func Shipped(dir, version string) (Snapshot, error)

Shipped reads the tool versions update in dir that this build, of version, can read: the newest, its worksWith judged (a dev- build's is not), its list validated, as a snapshot named by the update.

func (Snapshot) HasLine

func (s Snapshot) HasLine(tool, line string) bool

HasLine says whether the snapshot's list names tool at line.

func (Snapshot) HasTool

func (s Snapshot) HasTool(tool string) bool

HasTool says whether the snapshot's list names tool at any line.

func (Snapshot) RunImage

func (s Snapshot) RunImage(tool, line string) (string, bool)

RunImage is the run image the snapshot's list names for tool at line; false when it names none.

type Source

type Source interface {
	Current() Snapshot
}

Source is what an owner that runs images asks: the current snapshot.

type Versions

type Versions struct {
	// contains filtered or unexported fields
}

Versions owns a process's tool versions: the current validated list.

func New

func New(s Snapshot) *Versions

New is an owner holding s.

func (*Versions) Current

func (v *Versions) Current() Snapshot

Current is the list in use, as a snapshot a unit of work keeps.

func (*Versions) HasLine

func (v *Versions) HasLine(tool, line string) bool

HasLine says whether the current list names tool at line.

func (*Versions) HasTool

func (v *Versions) HasTool(tool string) bool

HasTool says whether the current list names tool at any line.

func (*Versions) Install

func (v *Versions) Install(s Snapshot)

Install puts a newer validated list in place: work that starts from now on uses it, work under way keeps its snapshot. The seam for importing tool versions updates; nothing in this release calls it.

Jump to

Keyboard shortcuts

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