Documentation ¶
Overview ¶
Package build implements the logic for executing a single user build.
Index ¶
- Constants
- Variables
- type Build
- func (b *Build) Failbuild(err error)
- func (b *Build) GetStatus() BuildStatus
- func (b *Build) SetDockerAccessToken(tok string) error
- func (b *Build) Start()
- func (b *Build) Summary() BuildSummary
- func (b *Build) UpdateDockerAccessToken(tok string) error
- func (b *Build) UpdateStatus(status BuildStatus)
- type BuildStatus
- type BuildSummary
- type BuiltImage
- type Hash
- type HashType
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) SetDockerAccessToken ¶ added in v0.0.5
SetDockerAccessToken sets the initial Docker config with the credentials we use to authorize requests to GCR. https://cloud.google.com/container-registry/docs/advanced-authentication#using_an_access_token
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. https://cloud.google.com/container-registry/docs/advanced-authentication#using_an_access_token
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 successfully. 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.