dazzle

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOpt

type BuildOpt func(*buildOpts) error

BuildOpt modifies build behaviour

func WithCacheRef

func WithCacheRef(ref string) BuildOpt

WithCacheRef makes dazzle use a cache ref other than the target ref

func WithChunkedWithoutHash

func WithChunkedWithoutHash(enable bool) BuildOpt

WithChunkedWithoutHash disables the hash prefix for the chunked image tag

func WithNoCache

func WithNoCache(enable bool) BuildOpt

WithNoCache disables the buildkit build cache

func WithNoTests

func WithNoTests(enable bool) BuildOpt

WithNoTests disables the build-time tests

func WithPlainOutput

func WithPlainOutput(enable bool) BuildOpt

WithPlainOutput forces plain build output

func WithResolver

func WithResolver(r remotes.Resolver) BuildOpt

WithResolver makes the builder use a custom resolver

type BuildSession

type BuildSession struct {
	Client *client.Client
	Dest   reference.Named
	// contains filtered or unexported fields
}

BuildSession records all state of a build

func NewSession

func NewSession(cl *client.Client, targetRef string, options ...BuildOpt) (*BuildSession, error)

NewSession starts a new build session

func (*BuildSession) DownloadBaseInfo

func (s *BuildSession) DownloadBaseInfo(ctx context.Context, p *Project) (err error)

DownloadBaseInfo downloads the base image info

func (*BuildSession) PrintBuildInfo

func (s *BuildSession) PrintBuildInfo()

PrintBuildInfo logs information about the built chunks

type ChunkCombination

type ChunkCombination struct {
	Name   string   `yaml:"name"`
	Ref    []string `yaml:"ref"`
	Chunks []string `yaml:"chunks"`
}

ChunkCombination combines several chunks to a new image

type ChunkConfig

type ChunkConfig struct {
	Variants []ChunkVariant `yaml:"variants"`
}

ChunkConfig configures a chunk

type ChunkImageType

type ChunkImageType string

ChunkImageType describes the chunk build artifact type

const (
	// ImageTypeTest is an image built for testing
	ImageTypeTest ChunkImageType = "test"
	// ImageTypeFull is the full chunk image
	ImageTypeFull ChunkImageType = "full"
	// ImageTypeChunked is the chunk image with the base layers removed
	ImageTypeChunked ChunkImageType = "chunked"
	// ImageTypeChunkedNoHash is the chunk image with the base layers removed and no hash in the name
	ImageTypeChunkedNoHash ChunkImageType = "chunked-wohash"
)

type ChunkVariant

type ChunkVariant struct {
	Name       string            `yaml:"name"`
	Args       map[string]string `yaml:"args,omitempty"`
	Dockerfile string            `yaml:"dockerfile,omitempty"`
}

ChunkVariant is a variant of a chunk

type CombinerOpt

type CombinerOpt func(*combinerOpts) error

CombinerOpt configrues the combiner

func WithTests

func WithTests(cl *client.Client) CombinerOpt

WithTests enable tests after image combination

type EnvVarCombination

type EnvVarCombination struct {
	Name   string                  `yaml:"name"`
	Action EnvVarCombinationAction `yaml:"action"`
}

EnvVarCombination describes how env vars are combined

type EnvVarCombinationAction

type EnvVarCombinationAction string

EnvVarCombinationAction defines mode by which an env var is combined

const (
	// EnvVarCombineMerge means values are appended with :
	EnvVarCombineMerge EnvVarCombinationAction = "merge"
	// EnvVarCombineMergeUnique is like EnvVarCombineMerge but with unique values only
	EnvVarCombineMergeUnique EnvVarCombinationAction = "merge-unique"
	// EnvVarCombineUseLast means the last value wins
	EnvVarCombineUseLast EnvVarCombinationAction = "use-last"
	// EnvVarCombineUseFirst means the first value wins
	EnvVarCombineUseFirst EnvVarCombinationAction = "use-first"
)

type LoadFromDirOpts

type LoadFromDirOpts struct {
	FS func(dir string) fs.FS
}

LoadFromDirOpts configures LoadFromDir

type Project

type Project struct {
	Base   ProjectChunk
	Chunks []ProjectChunk
	Config ProjectConfig
}

Project is a dazzle build project

func LoadFromDir

func LoadFromDir(contextBase string, opts LoadFromDirOpts) (*Project, error)

LoadFromDir loads a dazzle project from disk

func (*Project) BaseRef

func (p *Project) BaseRef(build reference.Named) (reference.NamedTagged, error)

BaseRef returns the ref of the base image of a project

func (*Project) Build

func (p *Project) Build(ctx context.Context, session *BuildSession) error

Build builds all images in a project

func (*Project) Combine

func (p *Project) Combine(ctx context.Context, chunks []string, dest reference.Named, sess *BuildSession, opts ...CombinerOpt) (err error)

Combine combines a set of previously built chunks into a single image while maintaining the layer identity.

type ProjectChunk

type ProjectChunk struct {
	Name        string
	Dockerfile  []byte
	ContextPath string
	Tests       []*test.Spec
	Args        map[string]string
	// contains filtered or unexported fields
}

ProjectChunk represents a layer chunk in a project

func (*ProjectChunk) Hash

func (p *ProjectChunk) Hash(out io.Writer, sess *BuildSession) (string, error)

PrintManifest prints the manifest to writer ... this is intended for debugging only

func (*ProjectChunk) ImageName

func (p *ProjectChunk) ImageName(tpe ChunkImageType, sess *BuildSession) (reference.NamedTagged, error)

ImageName produces a chunk image name

func (*ProjectChunk) PrintManifest

func (p *ProjectChunk) PrintManifest(out io.Writer, sess *BuildSession) error

PrintManifest prints the manifest to writer ... this is intended for debugging only

type ProjectConfig

type ProjectConfig struct {
	Combiner struct {
		Combinations []ChunkCombination  `yaml:"combinations"`
		EnvVars      []EnvVarCombination `yaml:"envvars,omitempty"`
	} `yaml:"combiner"`
	ChunkIgnore []string `yaml:"ignore,omitempty"`
	// contains filtered or unexported fields
}

ProjectConfig is the structure of a project's dazzle.yaml

func LoadProjectConfig

func LoadProjectConfig(dir fs.FS) (*ProjectConfig, error)

LoadProjectConfig loads a dazzle project config file from disk

func (*ProjectConfig) Write

func (pc *ProjectConfig) Write(dir string) error

Write writes this config as YAML to a file

type Registry

type Registry interface {
	Push(ctx context.Context, ref reference.Named, opts storeInRegistryOptions) (absref reference.Digested, err error)
	Pull(ctx context.Context, ref reference.Reference, cfg interface{}) (manifest *ociv1.Manifest, absref reference.Digested, err error)
}

Registry provides container registry services

func NewResolverRegistry

func NewResolverRegistry(resolver remotes.Resolver) Registry

type StoredTestResult

type StoredTestResult struct {
	Passed bool `json:"passed"`
}

Jump to

Keyboard shortcuts

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