forklift

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package forklift provides the core functionality of the forklift tool

Index

Constants

View Source
const (
	// DeplsDirName is the directory in a pallet which contains deployment
	// configurations.
	DeplsDirName = "deployments"
	// DeplsFileExt is the file extension for deployment configuration files.
	DeplDefFileExt = ".deploy.yml"
)
View Source
const (
	StageStoreManifestFile     = "forklift-stage-store.yml"
	StageStoreManifestSwapFile = "forklift-stage-store-swap.yml"
)
View Source
const (
	LockTypeVersion       = "version"
	LockTypePseudoversion = "pseudoversion"
)
View Source
const BundleManifestFile = "forklift-bundle.yml"

BundleManifestFile is the name of the file describing each Forklift pallet bundle.

View Source
const PalletDefFile = "forklift-pallet.yml"

PalletDefFile is the name of the file defining each Forklift pallet.

View Source
const ReqsDirName = "requirements"

ReqsDirName is the directory in a Forklift pallet which contains requirement configurations.

View Source
const (
	// ReqsPalletsDirName is the subdirectory in the requirements directory of a Forklift pallet which
	// contains pallet requirement configurations.
	ReqsPalletsDirName = "pallets"
)
View Source
const (
	// ReqsReposDirName is the subdirectory in the requirements directory of a Forklift pallet which
	// contains repo requirement configurations.
	ReqsReposDirName = "repositories"
)
View Source
const Timestamp = "20060102150405"
View Source
const VersionLockDefFile = "forklift-version-lock.yml"

VersionLockDefFile is the name of the file defining each version lock of a repo.

Variables

This section is empty.

Functions

func CheckDeplDeps added in v0.2.0

func CheckDeplDeps(
	depls []*ResolvedDepl,
) (satisfiedDeps []SatisfiedDeplDeps, missingDeps []MissingDeplDeps, err error)

CheckDeplDeps produces reports of all satisfied and unsatisfied resource dependencies among all provided ResolvedDepl instances.

func CompareGitRepoReqs added in v0.6.0

func CompareGitRepoReqs(r, s GitRepoReq) int

CompareGitRepoReqs returns an integer comparing two RepoReq instances according to their paths and versions. The result will be 0 if the r and s have the same paths and versions; -1 if r has a path which alphabetically comes before the path of s or if the paths are the same but r has a lower version than s; or +1 if r has a path which alphabetically comes after the path of s or if the paths are the same but r has a higher version than s.

func ComparePallets added in v0.6.0

func ComparePallets(r, s Pallet) int

ComparePallets returns an integer comparing two Pallet instances according to their paths and versions. The result will be 0 if the r and s have the same paths and versions; -1 if r has a path which alphabetically comes before the path of s or if the paths are the same but r has a lower version than s; or +1 if r has a path which alphabetically comes after the path of s or if the paths are the same but r has a higher version than s.

func EnsureExists added in v0.1.8

func EnsureExists(dirPath string) error

func EnsureFSStageStore added in v0.7.0

func EnsureFSStageStore(fsys core.PathedFS, subdirPath, newStateStoreVersion string) error

EnsureFSStageStore initializes a FSStageStore at the specified directory path in the provided base filesystem, if a stage store is not already initialized there.

func Exists added in v0.1.8

func Exists(dirPath string) bool

func GetCommitTimestamp added in v0.1.8

func GetCommitTimestamp(c CommitTimeGetter, hash string) (string, error)

func ResolveDeps added in v0.5.0

func ResolveDeps(
	satisfiedDeps []SatisfiedDeplDeps, skipNonblocking bool,
) structures.Digraph[string]

ResolveDeps returns a digraph where each node is the name of a deployment and each edge goes from a deployment which requires some resource to a deployment which provides that resource. Thus, the returned graph is a graph of direct dependencies among deployments, excluding deployments with no dependency relationships. If the skipNonblocking arg is set, then nonblocking resource requirements are ignored as if they didn't exist.

func ShortCommit

func ShortCommit(commit string) string

func ToTimestamp

func ToTimestamp(t time.Time) string

Types

type Bundle added in v0.7.0

type Bundle struct {
	// Manifest is the Forklift bundle manifest for the pallet bundle.
	Manifest BundleManifest
}

A Bundle is a Forklift pallet bundle, a complete compilation of all files (except container images) needed for a pallet to be applied to a Docker host. Required repos & pallets are included directly in the bundle.

type BundleInclusionOverride added in v0.7.0

type BundleInclusionOverride struct {
	// Path is the path of the override. This should be a filesystem path.
	Path string `yaml:"path"`
	// Version is the version or pseudoversion of the override, if one can be determined.
	Version string `yaml:"version"`
	// Clean indicates whether the override has been determined to have no changes beyond its latest
	// Git commit, if the it's version-controlled with Git.
	Clean bool `yaml:"clean"`
}

type BundleInclusions added in v0.7.0

type BundleInclusions struct {
	// Pallets describes external pallets used to build the bundled pallet.
	Pallets map[string]BundlePalletInclusion `yaml:"pallets,omitempty"`
	// Repos describes package repositories used to build the bundled pallet.
	Repos map[string]BundleRepoInclusion `yaml:"repositories,omitempty"`
}

BundleInclusions describes the requirements used to build the bundled pallet.

func (*BundleInclusions) HasInclusions added in v0.7.0

func (i *BundleInclusions) HasInclusions() bool

func (*BundleInclusions) HasOverrides added in v0.7.0

func (i *BundleInclusions) HasOverrides() bool

type BundleManifest added in v0.7.0

type BundleManifest struct {
	// ForkliftVersion indicates that the pallet bundle was created assuming the semantics of a given
	// version of Forklift. The version must be a valid Forklift version, and it sets the minimum
	// version of Forklift required to use the pallet bundle. The Forklift tool refuses to use pallet
	// bundles declaring newer Forklift versions for any operations beyond printing information. The
	// Forklift version of the pallet bundle must be greater than or equal to the Forklift version of
	// every required Forklift repo or pallet bundle.
	ForkliftVersion string `yaml:"forklift-version"`
	// Pallet describes the basic metadata for the bundled pallet.
	Pallet BundlePallet `yaml:"pallet"`
	// Includes describes repos and pallets used to define the bundle's package deployments.
	Includes BundleInclusions `yaml:"includes,omitempty"`
	// Deploys describes deployments provided by the bundle. Keys are names of deployments.
	Deploys map[string]DeplDef `yaml:"deploys,omitempty"`
	// Deploys lists the target paths of file exports provided by the bundle's deployments. Keys are
	// names of the bundle's deployments which provide file exports.
	Exports map[string][]string `yaml:"exports,omitempty"`
}

A BundleManifest describes a Forklift pallet bundle.

type BundlePallet added in v0.7.0

type BundlePallet struct {
	// Path is the pallet bundle's path, which acts as the canonical name for the pallet bundle. It
	// should just be the path of the VCS repository for the bundled pallet.
	Path string `yaml:"path"`
	// Version is the version or pseudoversion of the bundled pallet, if one can be determined.
	Version string `yaml:"version"`
	// Clean indicates whether the bundled pallet has been determined to have no changes beyond its
	// latest Git commit, if the pallet is version-controlled with Git. This does not account for
	// overrides of required repos/pallets - those should be checked in BundleInclusions instead.
	Clean bool `yaml:"clean"`
	// Description is a short description of the bundled pallet to be shown to users.
	Description string `yaml:"description,omitempty"`
}

BundlePallet describes a bundle's bundled pallet.

type BundlePalletInclusion added in v0.7.0

type BundlePalletInclusion struct {
	Req PalletReq `yaml:"requirement,inline"`
	// Override describes the pallet used to override the required pallet, if an override was
	// specified for the pallet when building the bundled pallet.
	Override BundleInclusionOverride `yaml:"override,omitempty"`
}

BundlePalletInclusion describes a pallet used to build the bundled pallet.

type BundleRepoInclusion added in v0.7.0

type BundleRepoInclusion struct {
	Req RepoReq `yaml:"requirement,inline"`
	// Override describes the pallet used to override the required pallet, if an override was
	// specified for the pallet when building the bundled pallet.
	Override BundleInclusionOverride `yaml:"override,omitempty"`
}

BundleRepoInclusion describes a package repository used to build the bundled pallet.

type CommitTimeGetter added in v0.1.8

type CommitTimeGetter interface {
	GetCommitTime(hash string) (time.Time, error)
}

type Depl

type Depl struct {
	// Name is the name of the package depoyment.
	Name string
	// Def is the Forklift package deployment definition for the deployment.
	Def DeplDef
}

A Depl is a package deployment, a complete configuration of how a package is to be deployed on a Docker host.

func FilterDeplsForEnabled added in v0.4.0

func FilterDeplsForEnabled(depls []Depl) []Depl

FilterDeplsForEnabled filters a slice of Depls to only include those which are not disabled.

func (*Depl) ResAttachmentSource added in v0.2.0

func (d *Depl) ResAttachmentSource() []string

ResAttachmentSource returns the source path for resources under the Depl instance. The resulting slice is useful for constructing core.AttachedRes instances.

type DeplConflict added in v0.1.8

type DeplConflict struct {
	First  *ResolvedDepl
	Second *ResolvedDepl

	// Possible conflicts
	Name        bool
	Listeners   []core.ResConflict[core.ListenerRes]
	Networks    []core.ResConflict[core.NetworkRes]
	Services    []core.ResConflict[core.ServiceRes]
	Filesets    []core.ResConflict[core.FilesetRes]
	FileExports []core.ResConflict[core.FileExportRes]
}

func CheckDeplConflicts added in v0.1.8

func CheckDeplConflicts(depls []*ResolvedDepl) (conflicts []DeplConflict, err error)

CheckDeplConflicts produces a slice of reports of all resource conflicts among all provided ResolvedDepl instances.

func (DeplConflict) HasConflict added in v0.1.8

func (c DeplConflict) HasConflict() bool

func (DeplConflict) HasFileExportConflict added in v0.7.0

func (c DeplConflict) HasFileExportConflict() bool

func (DeplConflict) HasFilesetConflict added in v0.5.2

func (c DeplConflict) HasFilesetConflict() bool

func (DeplConflict) HasListenerConflict added in v0.1.8

func (c DeplConflict) HasListenerConflict() bool

func (DeplConflict) HasNameConflict added in v0.1.8

func (c DeplConflict) HasNameConflict() bool

func (DeplConflict) HasNetworkConflict added in v0.1.8

func (c DeplConflict) HasNetworkConflict() bool

func (DeplConflict) HasServiceConflict added in v0.1.8

func (c DeplConflict) HasServiceConflict() bool

type DeplDef added in v0.1.8

type DeplDef struct {
	// Package is the package path of the package to deploy.
	Package string `yaml:"package"`
	// Features is a list of features from the package which should be enabled in the deployment.
	Features []string `yaml:"features,omitempty"`
	// Disabled represents whether the deployment should be ignored.
	Disabled bool `yaml:"disabled,omitempty"`
}

A DeplDef defines a package deployment.

type FSBundle added in v0.7.0

type FSBundle struct {
	// Bundle is the pallet bundle at the root of the filesystem.
	Bundle
	// FS is a filesystem which contains the bundle's contents.
	FS core.PathedFS
}

A FSBundle is a Forklift pallet bundle stored at the root of a fs.FS filesystem.

func LoadFSBundle added in v0.7.0

func LoadFSBundle(fsys core.PathedFS, subdirPath string) (b *FSBundle, err error)

LoadFSBundle loads a FSBundle from a specified directory path in the provided base filesystem.

func NewFSBundle added in v0.7.0

func NewFSBundle(path string) *FSBundle

func (*FSBundle) AddResolvedDepl added in v0.7.0

func (b *FSBundle) AddResolvedDepl(depl *ResolvedDepl) (err error)

func (*FSBundle) LoadDepl added in v0.7.0

func (b *FSBundle) LoadDepl(name string) (Depl, error)

func (*FSBundle) LoadDepls added in v0.7.0

func (b *FSBundle) LoadDepls(searchPattern string) ([]Depl, error)

func (*FSBundle) LoadFSPkg added in v0.7.0

func (b *FSBundle) LoadFSPkg(pkgPath string, version string) (*core.FSPkg, error)

func (*FSBundle) LoadFSPkgs added in v0.7.0

func (b *FSBundle) LoadFSPkgs(searchPattern string) ([]*core.FSPkg, error)

func (*FSBundle) LoadFSRepo added in v0.7.0

func (b *FSBundle) LoadFSRepo(repoPath string, version string) (*core.FSRepo, error)

func (*FSBundle) LoadFSRepos added in v0.7.0

func (b *FSBundle) LoadFSRepos(searchPattern string) ([]*core.FSRepo, error)

func (*FSBundle) LoadPkgReq added in v0.7.0

func (b *FSBundle) LoadPkgReq(pkgPath string) (r PkgReq, err error)

func (*FSBundle) LoadResolvedDepl added in v0.7.0

func (b *FSBundle) LoadResolvedDepl(name string) (depl *ResolvedDepl, err error)

func (*FSBundle) Path added in v0.7.0

func (b *FSBundle) Path() string

func (*FSBundle) SetBundledPallet added in v0.7.0

func (b *FSBundle) SetBundledPallet(pallet *FSPallet) error

func (*FSBundle) WriteFileExports added in v0.7.0

func (b *FSBundle) WriteFileExports() error

func (*FSBundle) WriteManifestFile added in v0.7.0

func (b *FSBundle) WriteManifestFile() error

func (*FSBundle) WriteRepoDefFile added in v0.7.0

func (b *FSBundle) WriteRepoDefFile() error

WriteRepoDefFile creates a repo definition file at the packages path, so that all loaded packages are associated with a repo.

type FSPallet added in v0.3.0

type FSPallet struct {
	// Pallet is the pallet at the root of the filesystem.
	Pallet
	// FS is a filesystem which contains the pallet's contents.
	FS core.PathedFS
}

A FSPallet is a Forklift pallet stored at the root of a fs.FS filesystem.

func LoadFSPallet added in v0.3.0

func LoadFSPallet(fsys core.PathedFS, subdirPath string) (p *FSPallet, err error)

LoadFSPallet loads a FSPallet from the specified directory path in the provided base filesystem.

func LoadFSPalletContaining added in v0.3.0

func LoadFSPalletContaining(path string) (*FSPallet, error)

LoadFSPalletContaining loads the FSPallet containing the specified sub-directory path in the provided base filesystem. The provided path should use the host OS's path separators. The sub-directory path does not have to actually exist.

func LoadFSPallets added in v0.6.0

func LoadFSPallets(fsys core.PathedFS, searchPattern string) ([]*FSPallet, error)

LoadFSPallets loads all FSPallets from the provided base filesystem matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching pallet directories to search for. In the embedded Pallet of each loaded FSPallet, the version is *not* initialized.

func (*FSPallet) Exists added in v0.3.0

func (p *FSPallet) Exists() bool

Exists checks whether the pallet actually exists on the OS's filesystem.

func (*FSPallet) GetPalletReqsFS added in v0.6.0

func (p *FSPallet) GetPalletReqsFS() (core.PathedFS, error)

GetPalletReqsFS returns the fs.FS in the pallet which contains pallet requirement definitions.

func (*FSPallet) GetRepoReqsFS added in v0.3.0

func (p *FSPallet) GetRepoReqsFS() (core.PathedFS, error)

GetRepoReqsFS returns the fs.FS in the pallet which contains repo requirement definitions.

func (*FSPallet) LoadDepl added in v0.3.0

func (p *FSPallet) LoadDepl(name string) (depl Depl, err error)

LoadDepl loads the Depl with the specified name from the pallet.

func (*FSPallet) LoadDepls added in v0.3.0

func (p *FSPallet) LoadDepls(searchPattern string) ([]Depl, error)

LoadDepls loads all package deployment configurations matching the specified search pattern. The search pattern should not include the file extension for deployment specification files - the file extension will be appended to the search pattern by LoadDepls.

func (*FSPallet) LoadFSPalletReq added in v0.6.0

func (p *FSPallet) LoadFSPalletReq(palletPath string) (r *FSPalletReq, err error)

LoadFSPalletReq loads the FSPalletReq from the pallet for the pallet with the specified path.

func (*FSPallet) LoadFSPalletReqs added in v0.6.0

func (p *FSPallet) LoadFSPalletReqs(searchPattern string) ([]*FSPalletReq, error)

LoadFSPalletReqs loads all FSPalletReqs from the pallet matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching the pallet paths to search for.

func (*FSPallet) LoadFSRepoReq added in v0.3.0

func (p *FSPallet) LoadFSRepoReq(repoPath string) (r *FSRepoReq, err error)

LoadFSRepoReq loads the FSRepoReq from the pallet for the repo with the specified path.

func (*FSPallet) LoadFSRepoReqs added in v0.3.0

func (p *FSPallet) LoadFSRepoReqs(searchPattern string) ([]*FSRepoReq, error)

LoadFSRepoReqs loads all FSRepoReqs from the pallet matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching the repo paths to search for.

func (*FSPallet) LoadPkgReq added in v0.3.0

func (p *FSPallet) LoadPkgReq(pkgPath string) (r PkgReq, err error)

LoadPkgReq loads the PkgReq from the pallet for the package with the specified package path.

func (*FSPallet) LoadReadme added in v0.4.0

func (p *FSPallet) LoadReadme() ([]byte, error)

LoadReadme loads the readme file defined by the pallet.

func (*FSPallet) Path added in v0.4.0

func (p *FSPallet) Path() string

Path returns either the pallet's path (if specified) or its path on the filesystem.

func (*FSPallet) Remove added in v0.3.0

func (p *FSPallet) Remove() error

Remove deletes the cache from the OS's filesystem, if it exists.

type FSPalletCache added in v0.2.0

type FSPalletCache struct {
	// FS is the filesystem which corresponds to the cache of pallets.
	FS core.PathedFS
}

FSPalletCache is a PathedPalletCache implementation with copies of pallets stored in a core.PathedFS filesystem.

func (*FSPalletCache) Exists added in v0.2.0

func (c *FSPalletCache) Exists() bool

Exists checks whether the cache actually exists on the OS's filesystem.

func (*FSPalletCache) LoadFSPallet added in v0.2.0

func (c *FSPalletCache) LoadFSPallet(repoPath string, version string) (*FSPallet, error)

LoadFSPallet loads the FSPallet with the specified path and version. The loaded FSPallet instance is fully initialized.

func (*FSPalletCache) LoadFSPallets added in v0.2.0

func (c *FSPalletCache) LoadFSPallets(searchPattern string) ([]*FSPallet, error)

LoadFSPallets loads all FSPallets from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repo directories to search for. The loaded FSPallet instances are fully initialized.

func (*FSPalletCache) Path added in v0.2.0

func (c *FSPalletCache) Path() string

Path returns the path of the cache's filesystem.

func (*FSPalletCache) Remove added in v0.2.0

func (c *FSPalletCache) Remove() error

Remove deletes the cache from the OS's filesystem, if it exists.

type FSPalletLoader added in v0.2.0

type FSPalletLoader interface {
	// LoadFSPallet loads the FSPallet with the specified path and version.
	LoadFSPallet(palletPath string, version string) (*FSPallet, error)
	// LoadFSPallets loads all FSPallets matching the specified search pattern.
	LoadFSPallets(searchPattern string) ([]*FSPallet, error)
}

FSPalletLoader is a source of [FSPallet]s indexed by path and version.

type FSPalletReq added in v0.2.0

type FSPalletReq struct {
	// PalletReq is the pallet requirement at the root of the filesystem.
	PalletReq
	// FS is a filesystem which contains the pallet requirement's contents.
	FS core.PathedFS
}

A FSPalletReq is a pallet requirement stored at the root of a fs.FS filesystem.

type FSPkgLoader added in v0.1.8

type FSPkgLoader interface {
	// LoadFSPkg loads the FSPkg with the specified path and version.
	LoadFSPkg(pkgPath string, version string) (*core.FSPkg, error)
	// LoadFSPkgs loads all FSPkgs matching the specified search pattern.
	LoadFSPkgs(searchPattern string) ([]*core.FSPkg, error)
}

FSPkgLoader is a source of [core.FSPkg]s indexed by path and version.

type FSRepoCache added in v0.3.0

type FSRepoCache struct {
	// FS is the filesystem which corresponds to the cache of repos.
	FS core.PathedFS
}

FSRepoCache is a PathedRepoCache implementation with copies of repos (and thus of packages too) stored in a core.PathedFS filesystem.

func (*FSRepoCache) Exists added in v0.3.0

func (c *FSRepoCache) Exists() bool

Exists checks whether the cache actually exists on the OS's filesystem.

func (*FSRepoCache) LoadFSPkg added in v0.3.0

func (c *FSRepoCache) LoadFSPkg(pkgPath string, version string) (*core.FSPkg, error)

LoadFSPkg loads the FSPkg with the specified path and version. The loaded FSPkg instance is fully initialized.

func (*FSRepoCache) LoadFSPkgs added in v0.3.0

func (c *FSRepoCache) LoadFSPkgs(searchPattern string) ([]*core.FSPkg, error)

LoadFSPkgs loads all FSPkgs from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching package directories to search for. The loaded FSPkg instances are fully initialized.

func (*FSRepoCache) LoadFSRepo added in v0.3.0

func (c *FSRepoCache) LoadFSRepo(repoPath string, version string) (*core.FSRepo, error)

LoadFSRepo loads the FSRepo with the specified path and version. The loaded FSRepo instance is fully initialized.

func (*FSRepoCache) LoadFSRepos added in v0.3.0

func (c *FSRepoCache) LoadFSRepos(searchPattern string) ([]*core.FSRepo, error)

LoadFSRepos loads all FSRepos from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repo directories to search for. The loaded FSRepo instances are fully initialized.

func (*FSRepoCache) Path added in v0.3.0

func (c *FSRepoCache) Path() string

Path returns the path of the cache's filesystem.

func (*FSRepoCache) Remove added in v0.3.0

func (c *FSRepoCache) Remove() error

Remove deletes the cache from the OS's filesystem, if it exists.

type FSRepoLoader added in v0.1.8

type FSRepoLoader interface {
	// LoadFSRepo loads the FSRepo with the specified path and version.
	LoadFSRepo(repoPath string, version string) (*core.FSRepo, error)
	// LoadFSRepos loads all FSRepos matching the specified search pattern.
	LoadFSRepos(searchPattern string) ([]*core.FSRepo, error)
}

FSRepoLoader is a source of [core.FSRepo]s indexed by path and version.

type FSRepoReq added in v0.1.8

type FSRepoReq struct {
	// RepoReq is the repo requirement at the root of the filesystem.
	RepoReq
	// FS is a filesystem which contains the repo requirement's contents.
	FS core.PathedFS
}

A FSRepoReq is a repo requirement stored at the root of a fs.FS filesystem.

type FSStageStore added in v0.7.0

type FSStageStore struct {
	// Manifest is the Forklift stage store's manifest.
	Manifest StageStoreManifest
	// FS is the filesystem which corresponds to the store of staged pallets.
	FS core.PathedFS
}

FSStageStore is a source of bundles rooted at a single path, with bundles stored as incrementally-numbered directories within a core.PathedFS filesystem.

func LoadFSStageStore added in v0.7.0

func LoadFSStageStore(fsys core.PathedFS, subdirPath string) (s *FSStageStore, err error)

LoadFSStageStore loads a FSStageStore from the specified directory path in the provided base filesystem.

func (*FSStageStore) AllocateNew added in v0.7.0

func (s *FSStageStore) AllocateNew() (index int, err error)

AllocateNew creates a new directory for a staged pallet in the store with a new highest index.

func (*FSStageStore) CommitState added in v0.7.0

func (s *FSStageStore) CommitState() error

CommitState atomically updates the stage store's manifest file. Warning: on non-Unix platforms, the update is not entirely atomic!

func (*FSStageStore) Exists added in v0.7.0

func (s *FSStageStore) Exists() bool

Exists checks whether the store actually exists on the OS's filesystem.

func (*FSStageStore) GetBundlePath added in v0.7.0

func (s *FSStageStore) GetBundlePath(index int) string

GetBundlePath returns the full filesystem path of the pallet bundle at the specified index, whether or not a bundle actually exists on the filesystem at that index.

func (*FSStageStore) GetCurrent added in v0.7.0

func (s *FSStageStore) GetCurrent() (index int, ok bool)

GetCurrent returns the last stage which was successfully applied. It returns not-`ok` if no stage has been successfully applied so far.

func (*FSStageStore) GetNext added in v0.7.0

func (s *FSStageStore) GetNext() (index int, ok bool)

GetNext returns the next stage to be applied. It returns not-`ok` if no stage is to be applied.

func (*FSStageStore) GetPending added in v0.7.0

func (s *FSStageStore) GetPending() (index int, ok bool)

GetPending returns the next stage to be applied, if it's different from the last stage which was successfully applied. It returns not-`ok` if there is no next stage to be applied or if the two stages are identical.

func (*FSStageStore) GetRollback added in v0.7.0

func (s *FSStageStore) GetRollback() (index int, ok bool)

GetRollback returns the previous stage which was successfully applied before the last stage which was successfully applied. It returns not-`ok` if no such stage exists.

func (*FSStageStore) IdentifyHighest added in v0.7.0

func (s *FSStageStore) IdentifyHighest() (index int, err error)

IdentifyHighest identifies the staged pallet in the store with the highest index. Only positive indices are considered. If the cache is empty, an error is returned with zero as an index.

func (*FSStageStore) List added in v0.7.0

func (s *FSStageStore) List() (indices []int, err error)

List returns a numerically-sorted (in ascending order) list of staged pallet bundles in the store. Only positive indices are included.

func (*FSStageStore) LoadFSBundle added in v0.7.0

func (s *FSStageStore) LoadFSBundle(index int) (*FSBundle, error)

LoadFSBundle loads the FSBundle with the specified index. The loaded FSBundle instance is fully initialized.

func (*FSStageStore) NextFailed added in v0.7.0

func (s *FSStageStore) NextFailed() bool

NextFailed returns whether the next stage to be applied has encountered a failed application.

func (*FSStageStore) Path added in v0.7.0

func (s *FSStageStore) Path() string

Path returns the path of the store's filesystem.

func (*FSStageStore) RecordNextSuccess added in v0.7.0

func (s *FSStageStore) RecordNextSuccess(succeeded bool)

RecordNextSuccess records the whether stage which was to be applied had a successful application.

func (*FSStageStore) Remove added in v0.7.0

func (s *FSStageStore) Remove() error

Remove deletes the store from the OS's filesystem, if it exists.

func (*FSStageStore) RemoveBundleHistory added in v0.7.0

func (s *FSStageStore) RemoveBundleHistory(index int)

RemoveBundleHistory removes the specified bundle from the history.

func (*FSStageStore) RemoveBundleNames added in v0.7.0

func (s *FSStageStore) RemoveBundleNames(index int)

RemoveBundleNames removes all names for the specified bundle.

func (*FSStageStore) SetNext added in v0.7.0

func (s *FSStageStore) SetNext(index int)

SetNext sets the specified stage as the next one to be applied and resets the flag tracking whether the next stage to be applied has failed. It assumes that the specified stage actually exists. Setting a value of 0 will clear the state of the next stage to be applied, so no stage will be applied next.

type FSWorkspace added in v0.1.8

type FSWorkspace struct {
	FS core.PathedFS
}

func LoadWorkspace added in v0.1.8

func LoadWorkspace(dirPath string) (*FSWorkspace, error)

LoadWorkspace loads the workspace at the specified path. The workspace is usually just a home directory, e.g. $HOME; directories in the workspace are organized with the same structure as the default structure described by the [XDG base directory spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). The provided path must use the host OS's path separators.

func (*FSWorkspace) GetCurrentPallet added in v0.3.0

func (w *FSWorkspace) GetCurrentPallet() (*FSPallet, error)

func (*FSWorkspace) GetCurrentPalletPath added in v0.3.0

func (w *FSWorkspace) GetCurrentPalletPath() string

func (*FSWorkspace) GetDataPath added in v0.6.0

func (w *FSWorkspace) GetDataPath() string

func (*FSWorkspace) GetPalletCache added in v0.2.0

func (w *FSWorkspace) GetPalletCache() (*FSPalletCache, error)

func (*FSWorkspace) GetPalletCachePath added in v0.2.0

func (w *FSWorkspace) GetPalletCachePath() string

func (*FSWorkspace) GetRepoCache added in v0.3.0

func (w *FSWorkspace) GetRepoCache() (*FSRepoCache, error)

func (*FSWorkspace) GetRepoCachePath added in v0.3.0

func (w *FSWorkspace) GetRepoCachePath() string

func (*FSWorkspace) GetStageStore added in v0.7.0

func (w *FSWorkspace) GetStageStore(newStateStoreVersion string) (*FSStageStore, error)

GetStageStore loads the workspace's stage store from the path, initializing a state file (which has the specified minimum supported Forklift tool version) if it does not already exist.

func (*FSWorkspace) GetStageStorePath added in v0.7.0

func (w *FSWorkspace) GetStageStorePath() string

type GitRepoReq added in v0.6.0

type GitRepoReq struct {
	// GitRepoPath is the path of the required Git repository.
	RequiredPath string `yaml:"-"`
	// VersionLock specifies the version of the required Git repository.
	VersionLock VersionLock `yaml:"version-lock"`
}

A GitRepoReq is a requirement for a specific Git repository (e.g. a pallet or Forklift repo) at a specific version.

func (GitRepoReq) GetQueryPath added in v0.6.0

func (r GitRepoReq) GetQueryPath() string

GetQueryPath returns the path of the Git repo in version queries, which is of form gitRepoPath@version (e.g. github.com/PlanktoScope/pallets/core@v0.1.0).

func (GitRepoReq) Path added in v0.6.0

func (r GitRepoReq) Path() string

Path returns the path of the required Git repo.

type LayeredPalletCache added in v0.2.0

type LayeredPalletCache struct {
	// Underlay is the underlying cache.
	Underlay PathedPalletCache
	// Overlay is the overlying cache which is used instead of the underlying cache for pallets
	// covered by the overlying cache.
	Overlay OverlayPalletCache
}

LayeredPalletCache is a PathedPalletCache implementation where selected pallets can be overridden by an OverlayPalletCache, for loading pallets. The path of the LayeredPalletCache instance is just the path of the underlying cache.

func (*LayeredPalletCache) LoadFSPallet added in v0.2.0

func (c *LayeredPalletCache) LoadFSPallet(repoPath string, version string) (*FSPallet, error)

LoadFSPallet loads the FSPallet with the specified path and version. The loaded FSPallet instance is fully initialized. If the overlay cache expects to have the repo, it will attempt to load the repo; otherwise, the underlay cache will attempt to load the repo.

func (*LayeredPalletCache) LoadFSPallets added in v0.2.0

func (c *LayeredPalletCache) LoadFSPallets(searchPattern string) ([]*FSPallet, error)

LoadFSPallets loads all FSPallets from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repo directories to search for. The loaded FSPallet instances are fully initialized. All matching repos from the overlay cache will be included; all matching repos from the underlay cache will also be included, except for those repos which the overlay cache expected to have.

func (*LayeredPalletCache) Path added in v0.2.0

func (c *LayeredPalletCache) Path() string

Path returns the path of the underlying cache.

type LayeredRepoCache added in v0.3.0

type LayeredRepoCache struct {
	// Underlay is the underlying cache.
	Underlay PathedRepoCache
	// Overlay is the overlying cache which is used instead of the underlying cache for repos and
	// packages covered by the overlying cache.
	Overlay OverlayRepoCache
}

LayeredRepoCache is a PathedRepoCache implementation where selected repos can be overridden by an OverlayRepoCache, for loading repos and packages. The path of the LayeredRepoCache instance is just the path of the underlying cache.

func (*LayeredRepoCache) LoadFSPkg added in v0.3.0

func (c *LayeredRepoCache) LoadFSPkg(pkgPath string, version string) (*core.FSPkg, error)

LoadFSPkg loads the FSPkg with the specified path and version. The loaded FSPkg instance is fully initialized. If the overlay cache expects to have the package, it will attempt to load the package; otherwise, the underlay cache will attempt to load the package.

func (*LayeredRepoCache) LoadFSPkgs added in v0.3.0

func (c *LayeredRepoCache) LoadFSPkgs(searchPattern string) ([]*core.FSPkg, error)

LoadFSPkgs loads all FSPkgs from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching package directories to search for. The loaded FSPkg instances are fully initialized. All matching packages from the overlay cache will be included; all matching packages from the underlay cache will also be included, except for those packages which the overlay cache expected to have.

func (*LayeredRepoCache) LoadFSRepo added in v0.3.0

func (c *LayeredRepoCache) LoadFSRepo(
	repoPath string, version string,
) (*core.FSRepo, error)

LoadFSRepo loads the FSRepo with the specified path and version. The loaded FSRepo instance is fully initialized. If the overlay cache expects to have the repo, it will attempt to load the repo; otherwise, the underlay cache will attempt to load the repo.

func (*LayeredRepoCache) LoadFSRepos added in v0.3.0

func (c *LayeredRepoCache) LoadFSRepos(searchPattern string) ([]*core.FSRepo, error)

LoadFSRepos loads all FSRepos from the cache matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repo directories to search for. The loaded FSRepo instances are fully initialized. All matching repos from the overlay cache will be included; all matching repos from the underlay cache will also be included, except for those repos which the overlay cache expected to have.

func (*LayeredRepoCache) Path added in v0.3.0

func (c *LayeredRepoCache) Path() string

Path returns the path of the underlying cache.

type MissingDeplDeps added in v0.2.0

type MissingDeplDeps struct {
	Depl *ResolvedDepl

	Networks []core.MissingResDep[core.NetworkRes]
	Services []core.MissingResDep[core.ServiceRes]
	Filesets []core.MissingResDep[core.FilesetRes]
}

func (MissingDeplDeps) HasMissingDep added in v0.2.0

func (d MissingDeplDeps) HasMissingDep() bool

func (MissingDeplDeps) HasMissingFilesetDep added in v0.5.2

func (d MissingDeplDeps) HasMissingFilesetDep() bool

func (MissingDeplDeps) HasMissingNetworkDep added in v0.2.0

func (d MissingDeplDeps) HasMissingNetworkDep() bool

func (MissingDeplDeps) HasMissingServiceDep added in v0.2.0

func (d MissingDeplDeps) HasMissingServiceDep() bool

type OverlayPalletCache added in v0.2.0

type OverlayPalletCache interface {
	PalletCache
	// IncludesFSPallet reports whether the cache expects to have the specified pallet.
	// This result does not necessarily correspond to whether the cache actually has it.
	IncludesFSPallet(palletPath string, version string) bool
}

OverlayPalletCache is a PalletCache which can report whether it includes any particular pallet.

type OverlayRepoCache added in v0.3.0

type OverlayRepoCache interface {
	RepoCache
	// IncludesFSRepo reports whether the cache expects to have the specified repo.
	// This result does not necessarily correspond to whether the cache actually has it.
	IncludesFSRepo(repoPath string, version string) bool
	// IncludesFSPkg reports whether the cache expects to have the specified package.
	// This result does not necessarily correspond to whether the cache actually has it.
	IncludesFSPkg(pkgPath string, version string) bool
}

OverlayRepoCache is a RepoCache which can report whether it includes any particular repo or package.

type Pallet added in v0.3.0

type Pallet struct {
	// Def is the Forklift pallet definition for the pallet.
	Def PalletDef
	// Version is the version or pseudoversion of the pallet.
	Version string
}

A Pallet is a Forklift pallet, a complete specification of all package deployments which should be active on a Docker host.

func (Pallet) Check added in v0.6.0

func (p Pallet) Check() (errs []error)

Check looks for errors in the construction of the repo.

func (Pallet) Path added in v0.6.0

func (p Pallet) Path() string

Path returns the repo path of the Pallet instance.

func (Pallet) VersionQuery added in v0.6.0

func (p Pallet) VersionQuery() string

VersionQuery represents the Pallet instance as a version query.

type PalletCache added in v0.2.0

type PalletCache interface {
	FSPalletLoader
}

PalletCache is a source of pallets.

type PalletDef added in v0.3.0

type PalletDef struct {
	// ForkliftVersion indicates that the pallet was written assuming the semantics of a given version
	// of Forklift. The version must be a valid Forklift version, and it sets the minimum version of
	// Forklift required to use the pallet. The Forklift tool refuses to use pallets declaring newer
	// Forklift versions for any operations beyond printing information. The Forklift version of the
	// pallet must be greater than or equal to the Forklift version of every required Forklift repo or
	// pallet.
	ForkliftVersion string `yaml:"forklift-version"`
	// Pallet defines the basic metadata for the pallet.
	Pallet PalletSpec `yaml:"pallet,omitempty"`
}

A PalletDef defines a Forklift pallet.

func (PalletDef) Check added in v0.6.0

func (d PalletDef) Check() (errs []error)

Check looks for errors in the construction of the pallet configuration.

type PalletOverrideCache added in v0.2.0

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

PalletOverrideCache is an OverlayPalletCache implementation containing a set of pallets which can be retrieved from the root of the cache. A pallet from the cache will be retrieved if it is stored in the cache with a matching version, regardless of whether the pallet's own version actually matches - in other words, pallets can be stored with fictional versions.

func NewPalletOverrideCache added in v0.2.0

func NewPalletOverrideCache(
	overridePallets []*FSPallet, palletVersions map[string][]string,
) (*PalletOverrideCache, error)

NewPalletOverrideCache instantiates a new PalletOverrideCache with a given list of pallets, and a map associating pallet paths with lists of versions which the respective pallets will be associated with.

func (*PalletOverrideCache) IncludesFSPallet added in v0.2.0

func (c *PalletOverrideCache) IncludesFSPallet(palletPath string, version string) bool

IncludesFSPallet reports whether the PalletOverrideCache instance has a pallet with the specified path and version.

func (*PalletOverrideCache) LoadFSPallet added in v0.2.0

func (c *PalletOverrideCache) LoadFSPallet(palletPath string, version string) (*FSPallet, error)

LoadFSPallet loads the FSPallet with the specified path, if the version matches any of versions for the pallet in the cache. The loaded FSPallet instance is fully initialized.

func (*PalletOverrideCache) LoadFSPallets added in v0.2.0

func (c *PalletOverrideCache) LoadFSPallets(searchPattern string) ([]*FSPallet, error)

LoadFSPallets loads all FSPallets matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching pallets to search for. The loaded FSPallet instances are fully initialized.

func (*PalletOverrideCache) SetVersions added in v0.2.0

func (c *PalletOverrideCache) SetVersions(palletPath string, versions map[string]struct{})

SetVersions configures the cache to cover the specified versions of the specified pallet.

type PalletReq added in v0.2.0

type PalletReq struct {
	GitRepoReq `yaml:",inline"`
}

A PalletReq is a requirement for a specific pallet at a specific version.

func (PalletReq) GetCachePath added in v0.2.0

func (r PalletReq) GetCachePath() string

GetCachePath returns the path of the pallet in caches, which is of form palletPath@version (e.g. github.com/PlanktoScope/pallets@v0.1.0/core).

func (PalletReq) GetQueryPath added in v0.2.0

func (r PalletReq) GetQueryPath() string

GetQueryPath returns the path of the pallet in version queries, which is of form palletPath@version (e.g. github.com/PlanktoScope/pallets/core@v0.1.0).

type PalletSpec added in v0.3.0

type PalletSpec struct {
	// Path is the pallet path, which acts as the canonical name for the pallet. It should just be the
	// path of the VCS repository for the pallet.
	Path string `yaml:"path"`
	// Description is a short description of the pallet to be shown to users.
	Description string `yaml:"description"`
	// ReadmeFile is the name of a readme file to be shown to users.
	ReadmeFile string `yaml:"readme-file"`
}

PalletSpec defines the basic metadata for a Forklift pallet.

func (PalletSpec) Check added in v0.6.0

func (s PalletSpec) Check() (errs []error)

Check looks for errors in the construction of the pallet spec.

type PathedPalletCache added in v0.2.0

type PathedPalletCache interface {
	PalletCache
	core.Pather
}

PathedPalletCache is a PalletCache rooted at a single path.

type PathedRepoCache added in v0.3.0

type PathedRepoCache interface {
	RepoCache
	core.Pather
}

PathedRepoCache is a RepoCache rooted at a single path.

type PkgReq added in v0.1.8

type PkgReq struct {
	// PkgSubdir is the package subdirectory in the repo which should provide the required package.
	PkgSubdir string
	// Repo is the repo which should provide the required package.
	Repo RepoReq
}

A PkgReq is a requirement for a package at a specific version.

func LoadRequiredFSPkg added in v0.1.8

func LoadRequiredFSPkg(
	pkgReqLoader PkgReqLoader, pkgLoader FSPkgLoader, pkgPath string,
) (*core.FSPkg, PkgReq, error)

LoadRequiredFSPkg loads the specified package from the cache according to the specifications in the package requirements provided by the package requirement loader for the provided package path.

func (PkgReq) GetCachePath added in v0.1.8

func (r PkgReq) GetCachePath() string

GetCachePath returns the path of the package in caches, which is of form repoPath@version/pkgSubdir (e.g. github.com/PlanktoScope/pallets@v0.1.0/core/infrastructure/caddy-ingress).

func (PkgReq) GetQueryPath added in v0.1.8

func (r PkgReq) GetQueryPath() string

GetQueryPath returns the path of the package in version queries, which is of form repoPath/pkgSubdir@version (e.g. github.com/PlanktoScope/pallets/core/infrastructure/caddy-ingress@v0.1.0).

func (PkgReq) Path added in v0.1.8

func (r PkgReq) Path() string

Path returns the package path of the required package.

type PkgReqLoader added in v0.1.8

type PkgReqLoader interface {
	LoadPkgReq(pkgPath string) (PkgReq, error)
}

PkgReqLoader is a source of package requirements.

type RepoCache added in v0.3.0

type RepoCache interface {
	FSRepoLoader
	FSPkgLoader
}

RepoCache is a source of repos and packages.

type RepoOverrideCache added in v0.1.8

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

RepoOverrideCache is an OverlayRepoCache implementation containing a set of repos which can be retrieved from the root of the cache. A repo from the cache will be retrieved if it is stored in the cache with a matching version, regardless of whether the repo's own version actually matches - in other words, repos can be stored with fictional versions.

func NewRepoOverrideCache added in v0.1.8

func NewRepoOverrideCache(
	overrideRepos []*core.FSRepo, repoVersions map[string][]string,
) (*RepoOverrideCache, error)

NewRepoOverrideCache instantiates a new RepoOverrideCache with a given list of repos, and a map associating repo paths with lists of versions which the respective repos will be associated with.

func (*RepoOverrideCache) IncludesFSPkg added in v0.1.8

func (c *RepoOverrideCache) IncludesFSPkg(pkgPath string, version string) bool

IncludesFSPkg reports whether the RepoOverrideCache instance has a repo with the specified version which covers the specified package path.

func (*RepoOverrideCache) IncludesFSRepo added in v0.1.8

func (c *RepoOverrideCache) IncludesFSRepo(repoPath string, version string) bool

IncludesFSRepo reports whether the RepoOverrideCache instance has a repo with the specified path and version.

func (*RepoOverrideCache) LoadFSPkg added in v0.1.8

func (c *RepoOverrideCache) LoadFSPkg(pkgPath string, version string) (*core.FSPkg, error)

LoadFSPkg loads the FSPkg with the specified path, if the version matches any of versions for the package's repo in the cache. The loaded FSPkg instance is fully initialized.

func (*RepoOverrideCache) LoadFSPkgs added in v0.1.8

func (c *RepoOverrideCache) LoadFSPkgs(searchPattern string) ([]*core.FSPkg, error)

LoadFSPkgs loads all FSPkgs matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching package directories to search for. The loaded FSPkg instances are fully initialized.

func (*RepoOverrideCache) LoadFSRepo added in v0.1.8

func (c *RepoOverrideCache) LoadFSRepo(repoPath string, version string) (*core.FSRepo, error)

LoadFSRepo loads the FSRepo with the specified path, if the version matches any of versions for the repo in the cache. The loaded FSRepo instance is fully initialized.

func (*RepoOverrideCache) LoadFSRepos added in v0.1.8

func (c *RepoOverrideCache) LoadFSRepos(searchPattern string) ([]*core.FSRepo, error)

LoadFSRepos loads all FSRepos matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repos to search for. The loaded FSRepo instances are fully initialized.

func (*RepoOverrideCache) SetVersions added in v0.1.8

func (c *RepoOverrideCache) SetVersions(repoPath string, versions map[string]struct{})

SetVersions configures the cache to cover the specified versions of the specified repo.

type RepoReq added in v0.1.8

type RepoReq struct {
	GitRepoReq `yaml:",inline"`
}

A RepoReq is a requirement for a specific repo at a specific version.

func (RepoReq) GetCachePath added in v0.1.8

func (r RepoReq) GetCachePath() string

GetCachePath returns the path of the repo in caches, which is of form repoPath@version (e.g. github.com/PlanktoScope/pallets@v0.1.0/core).

func (RepoReq) GetPkgSubdir added in v0.1.8

func (r RepoReq) GetPkgSubdir(pkgPath string) string

GetPkgSubdir returns the package subdirectory within the required repo for the provided package path.

type ResolvedDepl added in v0.1.8

type ResolvedDepl struct {
	// Depl is the configured deployment of the package represented by Pkg.
	Depl
	// PkgReq is the package requirement for the deployment.
	PkgReq PkgReq
	// Pkg is the package to be deployed.
	Pkg *core.FSPkg
}

A ResolvedDepl is a deployment with a loaded package.

func ResolveDepl added in v0.1.8

func ResolveDepl(
	pkgReqLoader PkgReqLoader, pkgLoader FSPkgLoader, depl Depl,
) (resolved *ResolvedDepl, err error)

ResolveDepl loads the package from the FSPkgLoader instance based on the requirements in the provided deployment and the package requirement loader.

func ResolveDepls added in v0.1.8

func ResolveDepls(
	pkgReqLoader PkgReqLoader, pkgLoader FSPkgLoader, depls []Depl,
) (resolved []*ResolvedDepl, err error)

ResolveDepls loads the packages from the FSPkgLoader instance based on the requirements in the provided deployments and the package requirement loader.

func (*ResolvedDepl) Check added in v0.1.8

func (d *ResolvedDepl) Check() (errs []error)

func (*ResolvedDepl) CheckAllConflicts added in v0.1.8

func (d *ResolvedDepl) CheckAllConflicts(
	candidates []*ResolvedDepl,
) (conflicts []DeplConflict, err error)

CheckAllConflicts produces a slice of reports of all resource conflicts between the ResolvedDepl instance and each candidate ResolvedDepl.

func (*ResolvedDepl) CheckConflicts added in v0.1.8

func (d *ResolvedDepl) CheckConflicts(candidate *ResolvedDepl) (DeplConflict, error)

CheckConflicts produces a report of all resource conflicts between the ResolvedDepl instance and a candidate ResolvedDepl.

func (*ResolvedDepl) CheckDeps added in v0.2.0

func (d *ResolvedDepl) CheckDeps(
	candidates []*ResolvedDepl,
) (satisfied SatisfiedDeplDeps, missing MissingDeplDeps, err error)

CheckDeps produces a report of all resource requirements from the ResolvedDepl instance and which were and were not met by any candidate ResolvedDepl.

func (*ResolvedDepl) DefinesApp added in v0.4.0

func (d *ResolvedDepl) DefinesApp() (bool, error)

DefinesApp determines whether the deployment defines a Docker Compose app to be deployed.

func (*ResolvedDepl) DisabledFeatures added in v0.1.8

func (d *ResolvedDepl) DisabledFeatures() map[string]core.PkgFeatureSpec

DisabledFeatures returns a map of the package features not enabled by the deployment's configuration, with feature names as the keys of the map.

func (*ResolvedDepl) EnabledFeatures added in v0.1.8

func (d *ResolvedDepl) EnabledFeatures() (enabled map[string]core.PkgFeatureSpec, err error)

EnabledFeatures returns a map of the package features enabled by the deployment's configuration, with feature names as the keys of the map.

func (*ResolvedDepl) GetComposeFilenames added in v0.4.0

func (d *ResolvedDepl) GetComposeFilenames() ([]string, error)

GetComposeFilenames returns a list of the paths of the Compose files which must be merged into the Compose app, with feature-flagged Compose files ordered based on the alphabetical order of enabled feature flags.

func (*ResolvedDepl) GetFileExportTargets added in v0.7.0

func (d *ResolvedDepl) GetFileExportTargets() ([]string, error)

GetFileExportTargets returns a list of the target paths of the files to be exported by the package deployment, with all target file paths sorted alphabetically.

func (*ResolvedDepl) GetFileExports added in v0.7.0

func (d *ResolvedDepl) GetFileExports() ([]core.FileExportRes, error)

GetFileExports returns a list of file exports to be exported by the package deployment, with file export objects sorted alphabetically by their source file paths.

type SatisfiedDeplDeps added in v0.2.0

type SatisfiedDeplDeps struct {
	Depl *ResolvedDepl

	Networks []core.SatisfiedResDep[core.NetworkRes]
	Services []core.SatisfiedResDep[core.ServiceRes]
	Filesets []core.SatisfiedResDep[core.FilesetRes]
}

func (SatisfiedDeplDeps) HasSatisfiedDep added in v0.2.0

func (d SatisfiedDeplDeps) HasSatisfiedDep() bool

func (SatisfiedDeplDeps) HasSatisfiedFilesetDep added in v0.5.2

func (d SatisfiedDeplDeps) HasSatisfiedFilesetDep() bool

func (SatisfiedDeplDeps) HasSatisfiedNetworkDep added in v0.2.0

func (d SatisfiedDeplDeps) HasSatisfiedNetworkDep() bool

func (SatisfiedDeplDeps) HasSatisfiedServiceDep added in v0.2.0

func (d SatisfiedDeplDeps) HasSatisfiedServiceDep() bool

type StageStoreManifest added in v0.7.0

type StageStoreManifest struct {
	// ForkliftVersion indicates that the stage store manifest was written assuming the semantics of
	// a given version of Forklift. The version must be a valid Forklift version, and it sets the
	// minimum version of Forklift required to use the stage store. The Forklift tool refuses to use
	// stage stores declaring newer Forklift versions for any operations beyond printing information.
	ForkliftVersion string `yaml:"forklift-version"`
	// Stages keeps track of special stages
	Stages StagesSpec `yaml:"staged"`
}

A StageStoreManifest holds the state of the stage store.

func (StageStoreManifest) Write added in v0.7.0

func (m StageStoreManifest) Write(outputPath string) error

type StagesSpec added in v0.7.0

type StagesSpec struct {
	// Next is the index of the next staged pallet bundle which should be applied. Once it's applied
	// successfully, it'll be pushed onto the History stack.
	Next int `yaml:"next,omitempty"`
	// NextFailed records whether the next staged pallet bundle had failed to be applied.
	NextFailed bool `yaml:"next-failed,omitempty"`
	// History is the stack of staged pallet bundles which have been applied successfully, with the
	// most-recently-applied bundle last. The most-recently-applied bundle can be used as a fallback
	// If the next staged pallet bundle (if it exists) is not applied successfully.
	History []int `yaml:"history,omitempty"`
	// Names is a list of aliases for staged pallet bundles.
	Names map[string]int `yaml:"names,omitempty"`
}

StagesSpec describes the state of a stage store.

type VersionLock added in v0.1.8

type VersionLock struct {
	// Def is the version lock definition.
	Def VersionLockDef `yaml:",inline"`
	// Version is the version string corresponding to the configured version.
	Version string `yaml:"-"`
}

A VersionLock is a specification of a particular version of a repo or package.

func (VersionLock) Check added in v0.1.8

func (l VersionLock) Check() (errs []error)

Check looks for errors in the construction of the version lock.

type VersionLockDef added in v0.1.8

type VersionLockDef struct {
	// Type specifies the type of version lock (either "version" or "pseudoversion")
	Type string `yaml:"type"`
	// Tag specifies the VCS repository tag associated with the version or pseudoversion, if it
	// exists. If the type is "version", the tag should point to the commit corresponding to the
	// version; if the type is "pseudoversion", the tag should be the highest-versioned tag in the
	// ancestry of the commit corresponding to the version (and it is used as a "base version").
	Tag string `yaml:"tag,omitempty"`
	// Timestamp specifies the commit time (in UTC) of the commit corresponding to the version, as
	// a 14-character string.
	Timestamp string `yaml:"timestamp"`
	// Commit specifies the full hash of the commit corresponding to the version.
	Commit string `yaml:"commit"`
}

A VersionLockDef defines a requirement for a repo or package at a specific version.

func (VersionLockDef) IsCommitLocked added in v0.1.8

func (l VersionLockDef) IsCommitLocked() bool

func (VersionLockDef) ParseVersion added in v0.1.8

func (l VersionLockDef) ParseVersion() (semver.Version, error)

func (VersionLockDef) Pseudoversion added in v0.1.8

func (l VersionLockDef) Pseudoversion() (string, error)

func (VersionLockDef) ShortCommit added in v0.1.8

func (l VersionLockDef) ShortCommit() string

func (VersionLockDef) Version added in v0.1.8

func (l VersionLockDef) Version() (string, error)

Directories

Path Synopsis
Package cli has shared utilities and application logic for the forklift CLI
Package cli has shared utilities and application logic for the forklift CLI

Jump to

Keyboard shortcuts

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