Documentation
¶
Overview ¶
Package build implements the logic for executing a single user build.
Index ¶
Constants ¶
const StartStep = "-"
StartStep is a build step WaitFor dependency that is always satisfied.
Variables ¶
var ( // RunRm : if true, all `docker run` commands will be passed a `--rm` flag. RunRm = false )
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct {
// Lock to update the status of a build or read/write digests.
Mu sync.Mutex
Request cb.Build
HasMultipleSteps bool
Tokensource oauth2.TokenSource
Log *buildlog.BuildLog
Status BuildStatus
Runner runner.Runner
Done chan struct{}
Times map[BuildStatus]time.Duration
LastStateStart time.Time
// PushErrors tracks how many times a push got retried. This
// field is not protected by a mutex because the worker will
// only read it once the build is done, and the build only
// updates it before the build is done.
PushErrors int
GCRErrors map[string]int64
NumSourceBytes int64
// contains filtered or unexported fields
}
Build manages a single build.
func New ¶
func New(r runner.Runner, rq cb.Build, ts oauth2.TokenSource, bl *buildlog.BuildLog, hostWorkspaceDir string, local, push bool) *Build
New constructs a new Build.
func (*Build) GetStatus ¶
func (b *Build) GetStatus() BuildStatus
GetStatus returns the build's status in a thread-safe way.
func (*Build) Summary ¶
func (b *Build) Summary() BuildSummary
Summary returns the build's summary in a thread-safe way.
func (*Build) UpdateDockerAccessToken ¶
UpdateDockerAccessToken updates the credentials we use to authorize requests to GCR. docker-credential-gcr is a prerequisite to be installed.
func (*Build) UpdateStatus ¶
func (b *Build) UpdateStatus(status BuildStatus)
UpdateStatus updates the current status.
type BuildStatus ¶
type BuildStatus string
BuildStatus is a pseudo-enum of valid build states.
const ( // StatusFetchSource - Fetching source. StatusFetchSource BuildStatus = "FETCHSOURCE" // StatusBuild - Executing the build step images on the source. StatusBuild BuildStatus = "BUILD" // StatusPush - Pushing the resultant image to GCR. StatusPush BuildStatus = "PUSH" // StatusDone - Build completed seccussfully. StatusDone BuildStatus = "DONE" // StatusError - Build failed. StatusError BuildStatus = "ERROR" )
type BuildSummary ¶
type BuildSummary struct {
Status BuildStatus
BuiltImages []BuiltImage
BuildStepImages []string // index of build step -> digest, else empty string
FileHashes map[string][]Hash
}
BuildSummary is the data returned by the blocking /build/status endpoint.
type BuiltImage ¶
type BuiltImage struct {
// Name is the full name of an image, as given to 'docker pull $NAME'.
Name string
// Digest is the digest reported by registry2.0, if available. If not
// available, it will be the empty string.
Digest string
}
BuiltImage is information about an image that resulted from this build and was pushed to an image registry.