Documentation
¶
Index ¶
- Constants
- func IsContainersImageLayer(from string) bool
- func NewDockerishUrl(thing string) (dockerishUrl, error)
- type Bind
- type Binds
- type BuildConfig
- type Command
- type ImageSource
- type Import
- type Imports
- type Layer
- type LayerType
- type OverlayDir
- type StackerConfig
- type StackerFiles
- type Stackerfile
- type Storage
- type StringList
Constants ¶
const ( DockerLayer = "docker" TarLayer = "tar" OCILayer = "oci" BuiltLayer = "built" )
Variables ¶
This section is empty.
Functions ¶
func IsContainersImageLayer ¶
func NewDockerishUrl ¶
Types ¶
type BuildConfig ¶
type BuildConfig struct {
Prerequisites []string `yaml:"prerequisites"`
}
type Command ¶
type Command []string
Command allows this type to be parsed from the yaml parser as either a list of strings or if a single string is specified, it is split with shlex.Split() into a list.
func (*Command) UnmarshalYAML ¶
type ImageSource ¶
type ImageSource struct {
Type string `yaml:"type"`
Url string `yaml:"url"`
Tag string `yaml:"tag"`
Insecure bool `yaml:"insecure"`
}
func NewImageSource ¶
func NewImageSource(containersImageString string) (*ImageSource, error)
func (*ImageSource) ContainersImageURL ¶
func (is *ImageSource) ContainersImageURL() (string, error)
Returns a URL that can be passed to github.com/containers/image handling code.
func (*ImageSource) ParseTag ¶
func (is *ImageSource) ParseTag() (string, error)
type Imports ¶
type Imports []Import
func (*Imports) UnmarshalYAML ¶
Custom UnmarshalYAML from string/map/slice of strings/slice of maps into Imports
type Layer ¶
type Layer struct {
From ImageSource `yaml:"from"`
Imports Imports `yaml:"import"`
OverlayDirs []OverlayDir `yaml:"overlay_dirs"`
Run StringList `yaml:"run"`
Cmd Command `yaml:"cmd"`
Entrypoint Command `yaml:"entrypoint"`
FullCommand Command `yaml:"full_command"`
BuildEnvPt []string `yaml:"build_env_passthrough"`
BuildEnv map[string]string `yaml:"build_env"`
Environment map[string]string `yaml:"environment"`
Volumes []string `yaml:"volumes"`
Labels map[string]string `yaml:"labels"`
GenerateLabels StringList `yaml:"generate_labels"`
WorkingDir string `yaml:"working_dir"`
BuildOnly bool `yaml:"build_only"`
Binds Binds `yaml:"binds"`
RuntimeUser string `yaml:"runtime_user"`
}
type LayerType ¶
type LayerType struct {
Type string
Verity squashfs.VerityMetadata
}
func NewLayerType ¶
func NewLayerType(lt string, verity squashfs.VerityMetadata) (LayerType, error)
func NewLayerTypes ¶
func NewLayerTypes(lts []string, verity squashfs.VerityMetadata) ([]LayerType, error)
func (LayerType) MarshalText ¶ added in v0.19.0
func (*LayerType) UnmarshalText ¶ added in v0.19.0
type OverlayDir ¶
type StackerConfig ¶
type StackerConfig struct {
StackerDir string `yaml:"stacker_dir"`
OCIDir string `yaml:"oci_dir"`
RootFSDir string `yaml:"rootfs_dir"`
Debug bool `yaml:"-"`
StorageType string `yaml:"-"`
// EmbeddedFS should contain a (statically linked) lxc-wrapper binary
// (built from cmd/lxc-wrapper/lxc-wrapper.c) at
// lxc-wrapper/lxc-wrapper.
EmbeddedFS embed.FS `yaml:"-"`
}
StackerConfig is a struct that contains global (or widely used) stacker config options.
func (*StackerConfig) CacheFile ¶
func (sc *StackerConfig) CacheFile() string
func (*StackerConfig) Substitutions ¶
func (sc *StackerConfig) Substitutions() []string
Substitutions - return an array of substitutions for StackerFiles
type StackerFiles ¶
type StackerFiles map[string]*Stackerfile
Logic for working with multiple StackerFiles
func NewStackerFiles ¶
func NewStackerFiles(paths []string, validateHash bool, substituteVars []string) (StackerFiles, error)
NewStackerFiles reads multiple Stackerfiles from a list of paths and applies substitutions It adds the Stackerfiles mentioned in the prerequisite paths to the results
func (StackerFiles) LookupLayerDefinition ¶
func (sfm StackerFiles) LookupLayerDefinition(name string) (Layer, bool)
LookupLayerDefinition searches for the Layer entry within the Stackerfiles
type Stackerfile ¶
type Stackerfile struct {
// AfterSubstitutions is the contents of the stacker file after
// substitutions (i.e., the content that is actually used by stacker).
AfterSubstitutions string
// FileOrder is the order of elements as they appear in the stackerfile.
FileOrder []string
// directory relative to which the stackerfile content is referenced
ReferenceDirectory string
// contains filtered or unexported fields
}
func NewStackerfile ¶
func NewStackerfile(stackerfile string, validateHash bool, substitutions []string) (*Stackerfile, error)
NewStackerfile creates a new stackerfile from the given path. substitutions is a list of KEY=VALUE pairs of things to substitute. Note that this is explicitly not a map, because the substitutions are performed one at a time in the order that they are given.
func (*Stackerfile) DependencyOrder ¶
func (s *Stackerfile) DependencyOrder(sfm StackerFiles) ([]string, error)
DependencyOrder provides the list of layer names from a stackerfile in the order in which they should be built so all dependencies are satisfied.
func (*Stackerfile) Len ¶
func (sf *Stackerfile) Len() int
func (*Stackerfile) Prerequisites ¶
func (sf *Stackerfile) Prerequisites() ([]string, error)
Prerequisites provides the absolute paths to the Stackerfiles which are dependencies for building this Stackerfile
type Storage ¶
type Storage interface {
// Name of this storage driver (e.g. "overlay")
Name() string
// Create does the initial work to create a storage tag to be used
// in later operations.
Create(path string) error
// SetupEmptyRootfs() sets up an empty rootfs for contents to be
// written in (e.g. if it's a base tar file to be extracted).
SetupEmptyRootfs(name string) error
// Snapshot "copies" (maybe in a fs-specific fast way) one tag to
// another; snapshots should be readonly or not generally modifiable.
Snapshot(source string, target string) error
// Restore is like snapshot (in fact, the implementations may be the
// same), but marks the result as writable.
Restore(source string, target string) error
// Delete a storage tag.
Delete(path string) error
// Test if a storage tag exists.
Exists(thing string) bool
// Create a temporary writable snapshot of the source, returning the
// snapshot's tag and a cleanup function.
TemporaryWritableSnapshot(source string) (string, func(), error)
// Clean the storage: do unmounting, delete all caches/tags, etc.
Clean() error
// GC any storage that's no longer relevant for the layers in the
// layer-bases cache or output directory (note that this implies a GC
// of those OCI dirs as well).
GC() error
// Unpack is the thing that unpacks the specfied tag layer-bases OCI
// cache into the specified "name" (working dir), whatever that means
// for this storage.
//
// Unpack can do fancy things like using previously cached unpacks to
// speed things up, etc.
Unpack(tag, name string) error
// Repack repacks the specified working dir into the specified OCI dir.
Repack(name string, layerTypes []LayerType, sfm StackerFiles) error
// GetLXCRootfsConfig returns the string that should be set as
// lxc.rootfs.path in the LXC container's config.
GetLXCRootfsConfig(name string) (string, error)
// TarExtractLocation returns the location that a tar-based rootfs
// should be extracted to
TarExtractLocation(name string) string
// Add overlay_dirs into overlay metadata so that later we can mount them
// in the lxc container, works only for storage-type 'overlay'
SetOverlayDirs(name string, overlayDirs []OverlayDir, layerTypes []LayerType) error
}
type StringList ¶
type StringList []string
StringList allows this type to be parsed from the yaml parser as either a list of strings, or if the entry was just one string, it is a list of length one containing that string.
func (*StringList) UnmarshalYAML ¶
func (sol *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error