cli

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: 24 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRepoRequirements added in v0.7.0

func AddRepoRequirements(
	indent int, pallet *forklift.FSPallet, cachePath string, repoQueries []string,
) error

func ApplyNextOrCurrentBundle added in v0.7.0

func ApplyNextOrCurrentBundle(
	indent int, store *forklift.FSStageStore, bundle *forklift.FSBundle, parallel bool,
) error

func BulletedPrint

func BulletedPrint(indent int, a ...any)

func BulletedPrintYaml

func BulletedPrintYaml(indent int, a any) error

func BulletedPrintf

func BulletedPrintf(indent int, format string, a ...any)

func BulletedPrintln

func BulletedPrintln(indent int, a ...any)

func CacheAllRequirements added in v0.6.0

func CacheAllRequirements(
	pallet *forklift.FSPallet, repoCachePath string, pkgLoader forklift.FSPkgLoader,
	includeDisabled, parallel bool,
) (changed bool, err error)

func CacheStagingRequirements added in v0.7.0

func CacheStagingRequirements(
	pallet *forklift.FSPallet, repoCachePath string,
) (changed bool, err error)

func Check added in v0.7.0

func Check(
	indent int, deplsLoader ResolvedDeplsLoader, pkgLoader forklift.FSPkgLoader,
) ([]*forklift.ResolvedDepl, []forklift.SatisfiedDeplDeps, error)

Check checks the validity of the pallet or bundle.

func CheckArtifactCompatibility added in v0.7.0

func CheckArtifactCompatibility(
	artifactVersion, toolVersion, minArtifactVersion, artifactPath string, ignoreTool bool,
) error

CheckArtifactCompatibility determines whether the version of Forklift required by an artifact (a repo or pallet), as declared by that artifact's Forklift version, is compatible with the actual version of the Forklift tool, and whether the artifact's Forklift version is compatible with the tool's minimum supported Forklift version for artifacts. compatErr is non-nil when the versions fail the compatibility check, while checkErr is non-nil when any specified version is invalid.

func CheckBundleShallowCompatibility added in v0.7.0

func CheckBundleShallowCompatibility(
	bundle *forklift.FSBundle, toolVersion, bundleMinVersion string, ignoreTool bool,
) error

func CheckCompatibility added in v0.4.0

func CheckCompatibility(
	pallet *forklift.FSPallet, repoLoader forklift.FSRepoLoader,
	toolVersion, repoMinVersion, palletMinVersion string, ignoreTool bool,
) error

CheckCompatibility returns an error upon any version compatibility errors between a pallet, its required pallets & repos (as loaded by repoLoader), and - unless the ignoreTool flag is set - the Forklift tool (whose version is specified as toolVersion, and whose minimum compatible Forklift versions are specified as repoMinVersion and palletMinVersion). Note that minimum versions are still enforced even if the ignoreTool flag is set.

func CheckShallowCompatibility added in v0.4.0

func CheckShallowCompatibility(
	pallet *forklift.FSPallet, repoLoader forklift.FSRepoLoader,
	toolVersion, repoMinVersion, palletMinVersion string, ignoreTool bool,
) error

CheckShallowCompatibility returns an error upon any version compatibility errors between a pallet and - unless the ignoreTool flag is set - the Forklift tool (whose version is specified as toolVersion, and whose minimum compatible Forklift versions are specified as repoMinVersion and palletMinVersion). Note that minimum versions are still enforced even if the ignoreTool flag is set.

func CloneQueriedGitRepoUsingLocalMirror added in v0.6.0

func CloneQueriedGitRepoUsingLocalMirror(
	indent int, cachePath string, query string, destination string,
) error

func DownloadImages

func DownloadImages(
	indent int, deplsLoader ResolvedDeplsLoader, pkgLoader forklift.FSPkgLoader,
	includeDisabled, parallel bool,
) error

func DownloadImagesForStoreApply added in v0.7.0

func DownloadImagesForStoreApply(
	store *forklift.FSStageStore, toolVersion, bundleMinVersion string,
	parallel, ignoreToolVersion bool,
) error

func DownloadLockedGitRepoUsingLocalMirror added in v0.6.0

func DownloadLockedGitRepoUsingLocalMirror(
	indent int, cachePath string, gitRepoPath string, lock forklift.VersionLock,
) (downloaded bool, err error)

func DownloadQueriedGitReposUsingLocalMirrors added in v0.6.0

func DownloadQueriedGitReposUsingLocalMirrors(
	indent int, cachePath string, queries []string,
) (resolved map[string]forklift.GitRepoReq, changed map[forklift.GitRepoReq]bool, err error)

func DownloadRequiredPallets added in v0.6.0

func DownloadRequiredPallets(
	indent int, pallet *forklift.FSPallet, cachePath string,
) (changed bool, err error)

func DownloadRequiredRepos added in v0.6.0

func DownloadRequiredRepos(
	indent int, pallet *forklift.FSPallet, cachePath string,
) (changed bool, err error)

func GetPalletCache added in v0.6.0

func GetPalletCache(
	wpath string, pallet *forklift.FSPallet, ensureCache bool,
) (*forklift.FSPalletCache, error)

func GetRepoCache added in v0.6.0

func GetRepoCache(
	wpath string, pallet *forklift.FSPallet, ensureCache bool,
) (*forklift.LayeredRepoCache, *forklift.RepoOverrideCache, error)

func GetStageStore added in v0.7.0

func GetStageStore(
	workspace *forklift.FSWorkspace, stageStorePath, newStageStoreVersion string,
) (*forklift.FSStageStore, error)

func IndentedPrint

func IndentedPrint(indent int, a ...any)

func IndentedPrintYaml

func IndentedPrintYaml(indent int, a any) error

func IndentedPrintf

func IndentedPrintf(indent int, format string, a ...any)

func IndentedPrintln

func IndentedPrintln(indent int, a ...any)

func PrintCachedPallet added in v0.6.0

func PrintCachedPallet(indent int, cache core.Pather, pallet *forklift.FSPallet) error

func PrintCachedRepo added in v0.6.0

func PrintCachedRepo(indent int, cache core.Pather, repo *core.FSRepo) error

func PrintDeplInfo

func PrintDeplInfo(
	indent int, pallet *forklift.FSPallet, cache forklift.PathedRepoCache, deplName string,
) error

func PrintDeplPkgPath added in v0.5.0

func PrintDeplPkgPath(
	indent int, pallet *forklift.FSPallet, cache forklift.PathedRepoCache, deplName string,
	allowDisabled bool,
) error

func PrintDeplSpec

func PrintDeplSpec(indent int, spec core.PkgDeplSpec)

func PrintFeatureSpec added in v0.4.0

func PrintFeatureSpec(indent int, name string, spec core.PkgFeatureSpec)

func PrintFeatureSpecs

func PrintFeatureSpecs(indent int, features map[string]core.PkgFeatureSpec)

func PrintPalletDepls added in v0.3.0

func PrintPalletDepls(indent int, pallet *forklift.FSPallet, loader forklift.FSPkgLoader) error

func PrintPalletInfo added in v0.2.0

func PrintPalletInfo(indent int, pallet *forklift.FSPallet) error

func PrintPalletPkgs added in v0.3.0

func PrintPalletPkgs(indent int, pallet *forklift.FSPallet, loader forklift.FSPkgLoader) error

func PrintPalletRepos added in v0.3.0

func PrintPalletRepos(indent int, pallet *forklift.FSPallet) error

func PrintPkg

func PrintPkg(indent int, cache forklift.PathedRepoCache, pkg *core.FSPkg)

func PrintPkgInfo

func PrintPkgInfo(
	indent int, pallet *forklift.FSPallet, cache forklift.PathedRepoCache, pkgPath string,
) error

func PrintPkgSpec

func PrintPkgSpec(indent int, spec core.PkgSpec)

func PrintReadme added in v0.2.0

func PrintReadme(indent int, readme []byte, widthLimit int)

func PrintRepoInfo

func PrintRepoInfo(
	indent int, pallet *forklift.FSPallet, cache forklift.PathedRepoCache, repoPath string,
) error

func PrintResolvedDepl added in v0.7.0

func PrintResolvedDepl(
	indent int, cache forklift.PathedRepoCache, resolved *forklift.ResolvedDepl,
) error

func PrintStagedBundle added in v0.7.0

func PrintStagedBundle(
	indent int, store *forklift.FSStageStore, bundle *forklift.FSBundle, index int, names []string,
)

func SetNextStagedBundle added in v0.7.0

func SetNextStagedBundle(
	store *forklift.FSStageStore, index int, exportPath, toolVersion, bundleMinVersion string,
	skipImageCaching, parallel, ignoreToolVersion bool,
) error

func StagePallet added in v0.7.0

func StagePallet(
	pallet *forklift.FSPallet, stageStore *forklift.FSStageStore, repoCache forklift.PathedRepoCache,
	exportPath, toolVersion, bundleMinVersion, newBundleForkliftVersion string,
	skipImageCaching, parallel, ignoreToolVersion bool,
) (index int, err error)

Types

type ReconciliationChange added in v0.5.0

type ReconciliationChange struct {
	Name string
	Type string
	Depl *forklift.ResolvedDepl // this is nil for an app to be removed
	App  api.Stack              // this is empty for an app which does not yet exist
}

func Plan added in v0.7.0

func Plan(
	indent int, deplsLoader ResolvedDeplsLoader, pkgLoader forklift.FSPkgLoader, parallel bool,
) (
	changeDeps structures.Digraph[*ReconciliationChange], serialization []*ReconciliationChange,
	err error,
)

Plan builds a plan for changes to make to the Docker host in order to reconcile it with the desired state as expressed by the pallet or bundle. The plan is expressed as a dependency graph which can be used to build a partial ordering of the changes (where each change is a node in the graph) for concurrent execution, and - if serial execution is required either because the parallel arg is set to true or because a dependency cycle was detected - a total ordering of the changes for serial (rather than concurrent) execution.

func (*ReconciliationChange) PlanString added in v0.5.0

func (c *ReconciliationChange) PlanString() string

func (*ReconciliationChange) String added in v0.5.0

func (c *ReconciliationChange) String() string

type ResolvedDeplsLoader added in v0.7.0

type ResolvedDeplsLoader interface {
	forklift.PkgReqLoader
	LoadDepls(searchPattern string) ([]forklift.Depl, error)
}

Jump to

Keyboard shortcuts

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