builder

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package builder provides common methods for Builder implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyReplacements added in v0.2.0

func ApplyReplacements(build *v1alpha1.Build, replacements map[string]string) *v1alpha1.Build

ApplyReplacements replaces placeholders for declared parameters with the specified replacements.

func ApplyTemplate

func ApplyTemplate(u *v1alpha1.Build, tmpl v1alpha1.BuildTemplateInterface) (*v1alpha1.Build, error)

ApplyTemplate applies the values in the template to the build, and replaces placeholders for declared parameters with the build's matching arguments.

func ErrorMessage

func ErrorMessage(status *v1alpha1.BuildStatus) (string, bool)

ErrorMessage returns the error message from the status.

func IsDone

func IsDone(status *v1alpha1.BuildStatus) bool

IsDone returns true if the build's status indicates the build is done.

func IsTimeout added in v0.2.0

func IsTimeout(status *v1alpha1.BuildStatus, buildTimeout *metav1.Duration) bool

IsTimeout returns true if the build's execution time is greater than specified build spec timeout.

Types

type Build

type Build interface {
	// Execute launches this particular build and returns an Operation to track it's progress.
	Execute() (Operation, error)
}

Build defines the interface for launching a build and getting an Operation by which to track it to completion.

type Interface

type Interface interface {
	// Which builder are we?
	Builder() v1alpha1.BuildProvider

	// Validate a Build for this flavor of builder.
	Validate(*v1alpha1.Build) error

	// Construct a Build for this flavor of builder from our CRD specification.
	BuildFromSpec(*v1alpha1.Build) (Build, error)

	// Construct an Operation for this flavor of builder from a BuildStatus.
	OperationFromStatus(*v1alpha1.BuildStatus) (Operation, error)
}

Interface defines the set of operations that all builders must implement.

type Operation

type Operation interface {
	// Name provides the unique name for this operation, see OperationFromStatus.
	Name() string

	// Checkpoint augments the provided BuildStatus with sufficient state to be
	// restored by OperationFromStatus on an appropriate BuildProvider.
	//
	// This takes into account necessary information about the provided Build.
	Checkpoint(*v1alpha1.Build, *v1alpha1.BuildStatus) error

	// Wait blocks until the Operation completes, returning either a status for the build or an error.
	// TODO(mattmoor): This probably shouldn't be BuildStatus, but some sort of smaller-scope thing.
	Wait() (*v1alpha1.BuildStatus, error)

	// Terminate cleans up this particular operation and returns an error if it fails
	Terminate() error
}

Operation defines the interface for interacting with an Operation of a particular BuildProvider.

Directories

Path Synopsis
Package cluster provides a Builder that runs workloads on-cluster.
Package cluster provides a Builder that runs workloads on-cluster.
convert
Package convert provides methods to convert a Build CRD to a k8s Pod resource.
Package convert provides methods to convert a Build CRD to a k8s Pod resource.
Package nop provides a no-op builder implementation.
Package nop provides a no-op builder implementation.
Package validation provides methods to surface validation errors.
Package validation provides methods to surface validation errors.

Jump to

Keyboard shortcuts

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