build

package
v1.37.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 27 Imported by: 18

Documentation

Index

Constants

View Source
const (
	PushImageErr = "could not push image"
)

Variables

This section is empty.

Functions

func InOrder added in v1.7.1

func InOrder(ctx context.Context, out io.Writer, tags tag.ImageTags, platforms platform.Resolver, artifacts []*latestV1.Artifact, artifactBuilder ArtifactBuilder, concurrency int, store ArtifactStore) ([]graph.Artifact, error)

InOrder builds a list of artifacts in dependency order.

func MergeWithPreviousBuilds added in v0.27.0

func MergeWithPreviousBuilds(builds, previous []graph.Artifact) []graph.Artifact

MergeWithPreviousBuilds merges previous or prebuilt build artifacts with builds. If an artifact is already present in builds, the same artifact from previous will be replaced at the same position.

func TagWithDigest added in v1.1.0

func TagWithDigest(tag, digest string) string

func TagWithImageID added in v1.1.0

func TagWithImageID(ctx context.Context, tag string, imageID string, localDocker docker.LocalDaemon) (string, error)

Types

type ArtifactBuilder added in v1.7.1

type ArtifactBuilder func(ctx context.Context, out io.Writer, artifact *latestV1.Artifact, tag string, platforms platform.Matcher) (string, error)

func WithLogFile added in v1.7.1

func WithLogFile(builder ArtifactBuilder, muted Muted) ArtifactBuilder

WithLogFile wraps an `artifactBuilder` so that it optionally outputs its logs to a file.

type ArtifactStore added in v1.7.1

type ArtifactStore interface {
	Record(a *latestV1.Artifact, tag string)
	GetImageTag(imageName string) (tag string, found bool)
	GetArtifacts(s []*latestV1.Artifact) ([]graph.Artifact, error)
}

ArtifactStore stores the results of each artifact build.

func NewArtifactStore added in v1.7.1

func NewArtifactStore() ArtifactStore

type Builder

type Builder interface {
	Build(ctx context.Context, out io.Writer, tags tag.ImageTags, platforms platform.Resolver, artifacts []*latestV1.Artifact) ([]graph.Artifact, error)

	// Prune removes images built with Skaffold
	Prune(context.Context, io.Writer) error
}

Builder is an interface to the Build API of Skaffold. It must build and make the resulting image accessible to the cluster. This could include pushing to a authorized repository or loading the nodes with the image. If artifacts is supplied, the builder should only rebuild those artifacts.

type BuilderMux added in v1.18.0

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

BuilderMux encapsulates multiple build configs.

func NewBuilderMux added in v1.18.0

func NewBuilderMux(cfg Config, store ArtifactStore, builder func(p latestV1.Pipeline) (PipelineBuilder, error)) (*BuilderMux, error)

NewBuilderMux returns an implementation of `build.BuilderMux`.

func (*BuilderMux) Build added in v1.18.0

func (b *BuilderMux) Build(ctx context.Context, out io.Writer, tags tag.ImageTags, resolver platform.Resolver, artifacts []*latestV1.Artifact) ([]graph.Artifact, error)

Build executes the specific image builder for each artifact in the given artifact slice.

func (*BuilderMux) Prune added in v1.18.0

func (b *BuilderMux) Prune(ctx context.Context, writer io.Writer) error

Prune removes built images.

type Config added in v1.18.0

type Config interface {
	GetPipelines() []latestV1.Pipeline
	DefaultRepo() *string
	MultiLevelRepo() *bool
	GlobalConfig() string
	BuildConcurrency() int
}

Config represents an interface for getting all config pipelines.

type ErrCustomBuildNoDockerfile added in v1.34.1

type ErrCustomBuildNoDockerfile struct{}

func (ErrCustomBuildNoDockerfile) Error added in v1.34.1

type ErrSyncMapNotSupported added in v0.32.0

type ErrSyncMapNotSupported struct{}

func (ErrSyncMapNotSupported) Error added in v0.32.0

type Muted added in v1.7.1

type Muted interface {
	MuteBuild() bool
}

type PipelineBuilder added in v1.18.0

type PipelineBuilder interface {

	// PreBuild executes any one-time setup required prior to starting any build on this builder
	PreBuild(ctx context.Context, out io.Writer) error

	// Build returns the `ArtifactBuilder` based on this build pipeline type
	Build(ctx context.Context, out io.Writer, artifact *latestV1.Artifact) ArtifactBuilder

	// PostBuild executes any one-time teardown required after all builds on this builder are complete
	PostBuild(ctx context.Context, out io.Writer) error

	// Concurrency specifies the max number of builds that can run at any one time. If concurrency is 0, then all builds can run in parallel.
	Concurrency() *int

	// Prune removes images built in this pipeline
	Prune(context.Context, io.Writer) error

	// PushImages specifies if the built image needs to be explicitly pushed to an image registry.
	PushImages() bool

	// SupportedPlatforms returns the platforms supported for building the image by this build pipeline type.
	SupportedPlatforms() platform.Matcher
}

PipelineBuilder is an interface for a specific Skaffold config pipeline build type. Current implementations are the `local`, `cluster` and `gcb`

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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