Documentation
¶
Overview ¶
Package stack is the desired state of a stack: the target, the installer, and the installations to make there, by their spec: a bundle, its parameters and the sources of its credentials. nemo up brings the target to it.
Index ¶
- Constants
- func CheckDependencies(bundles []cnab.ExtendedBundle) error
- func DependencyNames(bundle cnab.ExtendedBundle) []string
- func Encode(stack Stack, format string) ([]byte, error)
- func Order(bundles []cnab.ExtendedBundle) ([]cnab.ExtendedBundle, error)
- type Requirement
- type Stack
- type Store
- func (store *Store) Current() (string, error)
- func (store *Store) List() ([]string, error)
- func (store *Store) Load(name string) (Stack, error)
- func (store *Store) Path(name string) (string, error)
- func (store *Store) Remove(name string) error
- func (store *Store) Save(stack Stack, format string) error
- func (store *Store) Use(name string) error
Constants ¶
const ( YAML = "yaml" JSON = "json" )
Formats of a manifest, which are also its extension.
Variables ¶
This section is empty.
Functions ¶
func CheckDependencies ¶
func CheckDependencies(bundles []cnab.ExtendedBundle) error
CheckDependencies reports each dependency the set does not satisfy: one whose reference is not REGISTRY/NAME, a bundle the set does not have, or one whose version is outside the dependency's ranges.
func DependencyNames ¶
func DependencyNames(bundle cnab.ExtendedBundle) []string
DependencyNames are the names of the bundles the bundle depends on.
func Encode ¶
Encode writes the stack as a manifest in format. Its installations give no stack: they are the manifest's.
func Order ¶
func Order(bundles []cnab.ExtendedBundle) ([]cnab.ExtendedBundle, error)
Order sorts the bundles so that each comes after the bundles of the set it depends on, with io.cnab.dependencies; otherwise their order is kept. A dependency on a bundle outside the set does not order anything: CheckDependencies reports it.
Types ¶
type Requirement ¶
type Requirement struct {
Dependant cnab.ExtendedBundle
Dependency cnab.Dependency
}
Requirement is a dependency of a bundle, its dependant.
func Missing ¶
func Missing(bundles []cnab.ExtendedBundle) []Requirement
Missing returns the dependencies no bundle of the set satisfies by name, each once, with the first bundle that requires it: the stack does not list them.
type Stack ¶
type Stack struct {
Name string `json:"name"`
Target target.Target `json:"target"`
Installer target.Installer `json:"installer,omitzero"`
// Remote says where an installation's bundle is when its reference has
// a version alone: the template of a location of the
// installation's name and its version,
// docker://ghcr.io/sntns/{{ .Component }}:{{ .Version }}, or
// oci:.artifacts/prod/{{ .Component }}.oci, relative to the stack file.
Remote string `json:"remote,omitempty"`
// Parameters go to every installation whose bundle declares a parameter
// of their name. An installation's own parameters override them.
Parameters map[string]string `json:"parameters,omitempty"`
// Credentials are a CNAB credential set for the whole stack: each goes
// to every installation whose bundle declares it. An installation's own
// credentials override them.
Credentials []valuesource.Strategy `json:"credentials,omitempty"`
Installations []storage.InstallationSpec `json:"installations"`
}
Stack is a stack file, the desired state of a stack, Porter's namespace: its target, its installer, and its installations.
func Read ¶
Read reads a stack file without validating it, to complete it first. Its paths, of bundle files and of credentials, are made absolute from the stack file's directory, and its installations are given its name as their stack.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps the stacks of a home by their name, each its manifest in a directory of its own, <name>/manifest.yaml or manifest.json, where its installations are kept too, and which one is current. A directory of the home without a manifest is no stack: the home can hold other files, those of a tool built on nemo.
func (*Store) Remove ¶
Remove removes the stack's directory, its manifest and the records of its installations, and makes no stack current if it was.