stacker

package
v0.40.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitVersionAnnotation      = "%s.stacker.git_version"
	StackerContentsAnnotation = "%s.stacker.stacker_yaml"
)
View Source
const DefaultShell = "/bin/sh"

Variables

This section is empty.

Functions

func CleanImportsDir

func CleanImportsDir(c types.StackerConfig, name string, imports types.Imports, cache *BuildCache) error

func Download

func Download(cacheDir string, url string, progress bool, expectedHash, remoteHash, remoteSize string,
	mode *fs.FileMode, uid, gid int,
) (string, error)

download with caching support in the specified cache dir.

func GetBase

func GetBase(o BaseLayerOpts) error

GetBase grabs the base layer and puts it in the cache.

func GitVersion

func GitVersion(path string) (string, error)

GitVersion generates a version string similar to what git describe --always does, with -dirty on the end if the git repo had local changes.

func Grab

func Grab(sc types.StackerConfig, storage types.Storage, name string, source string, targetDir string,
	mode *fs.FileMode, uid, gid int,
) error

func Import

func Import(c types.StackerConfig, storage types.Storage, name string, imports types.Imports, overlayDirs *types.OverlayDirs, progress bool) error

Import files from different sources to an ephemeral or permanent destination.

func SetupBuildContainerConfig

func SetupBuildContainerConfig(config types.StackerConfig, storage types.Storage, c *container.Container, name string) error

func SetupLayerConfig

func SetupLayerConfig(config types.StackerConfig, c *container.Container, l types.Layer, name string) error

func SetupRootfs

func SetupRootfs(o BaseLayerOpts) error

SetupRootfs assumes the base layer is correct in the cache, and sets up the base to the output.

If the layer is a build only layer, this code simply initializes the filesystem in roots to the built tag's filesystem.

func UnprivSetup

func UnprivSetup(c types.StackerConfig, username string, uid, gid int) error

Types

type BaseLayerOpts

type BaseLayerOpts struct {
	Config     types.StackerConfig
	Name       string
	Layer      types.Layer
	Cache      *BuildCache
	OCI        casext.Engine
	LayerTypes []types.LayerType
	Storage    types.Storage
	Progress   bool
}

type BuildArgs

type BuildArgs struct {
	Config               types.StackerConfig
	LeaveUnladen         bool
	NoCache              bool
	Substitute           []string
	SubstituteFile       string
	OnRunFailure         string
	LayerTypes           []types.LayerType
	OrderOnly            bool
	HashRequired         bool
	SetupOnly            bool
	Progress             bool
	AnnotationsNamespace string
}

type BuildCache

type BuildCache struct {
	Cache   map[string]CacheEntry `json:"cache"`
	Version int                   `json:"version"`
	// contains filtered or unexported fields
}

func OpenCache

func OpenCache(config types.StackerConfig, oci casext.Engine, sfm types.StackerFiles) (*BuildCache, error)

func (*BuildCache) Lookup

func (c *BuildCache) Lookup(name string) (*CacheEntry, bool, error)

func (*BuildCache) Put

func (c *BuildCache) Put(name string, manifests map[types.LayerType]ispec.Descriptor) error

type Builder

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

Builder is responsible for building the layers based on stackerfiles

func NewBuilder

func NewBuilder(opts *BuildArgs) *Builder

NewBuilder initializes a new Builder struct

func (*Builder) BuildMultiple

func (b *Builder) BuildMultiple(paths []string) error

BuildMultiple builds a list of stackerfiles

type CacheEntry

type CacheEntry struct {
	// A map of LayerType:Manifest this build corresponds to.
	Manifests map[types.LayerType]ispec.Descriptor

	// A map of the import url to the base64 encoded result of mtree walk
	// or sha256 sum of a file, depending on what Type is.
	Imports map[string]ImportHash

	// A map of the overlay_dir url to the base64 encoded result of mtree walk
	OverlayDirs map[string]OverlayDirHash

	// The name of this layer as it was built. Useful for the BuildOnly
	// case to make sure it still exists, and for printing error messages.
	Name string

	// The layer to cache
	Layer types.Layer

	// If the layer is of type "built", this is a hash of the base layer's
	// CacheEntry, which contains a hash of its imports. If there is a
	// mismatch with the current base layer's CacheEntry, the layer should
	// be rebuilt.
	Base string
}

type ImportHash

type ImportHash struct {
	// Unfortuantely, mtree doesn't work if you just pass it a single file,
	// so we use the sha256sum of the file, or the mtree encoding if it's a
	// directory. This indicates which.
	Type ImportType
	Hash string
}

type ImportType

type ImportType int
const (
	ImportFile ImportType = iota
	ImportDir  ImportType = iota
)

func (ImportType) IsDir

func (it ImportType) IsDir() bool

type OverlayDirHash

type OverlayDirHash struct {
	Hash string
}

type PublishArgs

type PublishArgs struct {
	Config     types.StackerConfig
	ShowOnly   bool
	Substitute []string
	Tags       []string
	Url        string
	Username   string
	Password   string
	Force      bool
	Progress   bool
	SkipTLS    bool
	LayerTypes []types.LayerType
}

type Publisher

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

Publisher is responsible for publishing the layers based on stackerfiles

func NewPublisher

func NewPublisher(opts *PublishArgs) *Publisher

NewPublisher initializes a new Publisher struct

func (*Publisher) Publish

func (p *Publisher) Publish(file string) error

Publish layers in a single stackerfile

func (*Publisher) PublishMultiple

func (p *Publisher) PublishMultiple(paths []string) error

PublishMultiple published layers defined in a list of stackerfiles

type StackerFilesDAG

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

StackerDepsDAG processes the dependencies between different stacker recipes

func NewStackerFilesDAG

func NewStackerFilesDAG(sfMap types.StackerFiles) (*StackerFilesDAG, error)

NewStackerDepsDAG properly initializes a StackerDepsProcessor

func (*StackerFilesDAG) GetStackerFile

func (d *StackerFilesDAG) GetStackerFile(path string) *types.Stackerfile

func (*StackerFilesDAG) Sort

func (d *StackerFilesDAG) Sort() []string

Sort provides a serial build order for the stacker files

type StackerLocks

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

func (*StackerLocks) Unlock

func (ls *StackerLocks) Unlock()

Jump to

Keyboard shortcuts

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