Version: v0.0.0-...-e560ebb Latest Latest

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0



Package cloudbuild wraps interaction with Google Cloud Build.



This section is empty.


This section is empty.


This section is empty.


type Build

type Build struct {
	// Theses fields are always available.
	ID            string // UUID string with the build ID
	LogURL        string // URL to a UI page (for humans) with build logs
	Status        Status // see the enum
	StatusDetails string // human readable string with more details (if any)

	// These fields are available only for successful builds.
	InputHashes  map[string]string // SHA256 hashes of build inputs ("gs://..." => SHA256)
	OutputImage  string            // uploaded image name (if any)
	OutputDigest string            // digest (in "sha256:..." form) of the image

Build represents a pending, in-flight or completed build.

type Builder

type Builder struct {
	// contains filtered or unexported fields

Builder knows how to trigger Cloud Build builds and check their status.

func New

New prepares a Builder instance.

func (*Builder) Check

func (b *Builder) Check(ctx context.Context, bid string) (*Build, error)

Check returns details of a build given its ID.

func (*Builder) Trigger

func (b *Builder) Trigger(ctx context.Context, r Request) (*Build, error)

Trigger launches a new build, returning its details.

ID of the returned build can be used to query its status later in Check(...).

type Request

type Request struct {
	// Source is a reference to the uploaded tarball with the context directory.
	Source *storage.Object

	// Image is a name of the image (perhaps with ":<tag>") to produce and push.
	// Should include a docker registry part, e.g. have form "".
	// If empty, Builder will still build an image, but will not push it anywhere.
	// Useful to verify Dockerfile is working without accumulating cruft.
	Image string

	// Labels is a labels to put into the produced docker image (if any).
	Labels docker.Labels

Request specifies what we want to build and push.

It is passed to Trigger.

type Status

type Status string

Status is possible status of a Cloud Build.

const (
	StatusUnknown       Status = "STATUS_UNKNOWN"
	StatusQueued        Status = "QUEUED"
	StatusWorking       Status = "WORKING"
	StatusSuccess       Status = "SUCCESS"
	StatusFailure       Status = "FAILURE"
	StatusInternalError Status = "INTERNAL_ERROR"
	StatusTimeout       Status = "TIMEOUT"
	StatusCancelled     Status = "CANCELLED"


func (Status) IsTerminal

func (s Status) IsTerminal() bool

IsTerminal is true if the build is done (successfully or not).

Jump to

Keyboard shortcuts

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