build

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 55 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package build emulates Cloud Build's Builds API (cloudbuild.googleapis.com v1) over gRPC and REST on the API gateway, on both projects/*/builds and projects/*/locations/*/builds. Build steps run in order or by waitFor as Managed containers that share a per-Build /workspace volume (steps.go), at most build.concurrency Builds at a time while the rest wait QUEUED (runner.go). A Build's substitutions are expanded when it is created (subst.go), and the Secret versions in its availableSecrets read when it starts (secrets.go). timeout and queueTtl run on the Emulator clock. A Build's source comes from Cloud Storage or a Git URL (source.go). Step logs are appended as they run to log-BUILD_ID.txt in the Build's logsBucket, and kept in memory for /_emu/v1/build/<build name>/log (logs.go). Steps act as the Build's service account (serviceaccount.go) and reach the Instance by real hostname through the Build agent (agent.go, agentctl.go), and build, run and push images with the Build daemon at /var/run/docker.sock (daemon.go, credentials.go). Once the steps succeed, images are pushed and artifacts.objects uploaded (results.go). Every status change is published to the Project's cloud-builds topic when it exists (notify.go). Cloud Build v2 answers UNIMPLEMENTED.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(env *emu.Env) emu.Service

New returns the service.

Types

type Service

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

Service is the Cloud Build Service.

func (*Service) ApplySeed added in v0.10.0

func (s *Service) ApplySeed(ctx context.Context, section *yaml.Node, baseDir string) error

ApplySeed creates or updates the seeded Build triggers and worker pools. It is idempotent.

func (*Service) ClockAdvanced

func (s *Service) ClockAdvanced(ctx context.Context) error

ClockAdvanced expires QUEUED Builds and times out WORKING ones that the advance made due, before returning.

func (*Service) EnvVars

func (s *Service) EnvVars(gw string, endpoints map[string]string) map[string]string

EnvVars implements emu.EnvVarer (FR-CORE-004): the gcloud endpoint override for `gcloud builds`.

func (*Service) ExportSeed added in v0.10.0

func (s *Service) ExportSeed(ctx context.Context) (any, error)

ExportSeed implements emu.SeedExporter: every Build trigger and worker pool, without the fields the API sets. Builds are not exported.

func (*Service) Name

func (s *Service) Name() string

func (*Service) Ready

func (s *Service) Ready() error

Ready reports whether Build steps can run: a container runtime must be reachable. The result is cached for a few seconds.

func (*Service) Register

func (s *Service) Register(r emu.Router) error

Register installs the gRPC service, the REST surface, the log endpoint and the Build daemon's Admin API (daemon.go). The Build Operations are not listed with the Instance's other Operations: a State snapshot waits for those to finish, but must be possible while a Build runs.

func (*Service) Reset

func (s *Service) Reset(ctx context.Context) error

Reset stops the scheduler and every Build, waiting (bounded by ctx) until their containers and volumes are removed, so that none of them writes to the store after the Instance resets it (#307).

func (*Service) ResetDone

func (s *Service) ResetDone()

ResetDone runs the scheduler again once the store is reset too.

func (*Service) ResourceCounts

func (s *Service) ResourceCounts() map[string]int

ResourceCounts implements emu.ResourceCounter.

func (*Service) Restore

func (s *Service) Restore(ctx context.Context, dir string) error

Restore implements emu.Snapshotter. A Build that was QUEUED or WORKING when the State snapshot was saved cannot go on, since its containers are gone: it ends INTERNAL_ERROR.

func (*Service) Snapshot

func (s *Service) Snapshot(ctx context.Context, dir string) error

Snapshot implements emu.Snapshotter: a Build is all in the store.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start serves the pushes to pubsubConfig Build triggers (trigger_events.go), ends the Builds a previous process left unfinished and runs the scheduler.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop stops the scheduler and the running Builds, removing their containers; the next Start ends them INTERNAL_ERROR.

Jump to

Keyboard shortcuts

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