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). 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). Cloud Build v2 answers UNIMPLEMENTED.
Index ¶
- func New(env *emu.Env) emu.Service
- type Service
- func (s *Service) ClockAdvanced(ctx context.Context) error
- func (s *Service) EnvVars(gw string, endpoints map[string]string) map[string]string
- func (s *Service) Name() string
- func (s *Service) Ready() error
- func (s *Service) Register(r emu.Router) error
- func (s *Service) Reset(ctx context.Context) error
- func (s *Service) ResetDone()
- func (s *Service) ResourceCounts() map[string]int
- func (s *Service) Restore(ctx context.Context, dir string) error
- func (s *Service) Snapshot(ctx context.Context, dir string) error
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the Cloud Build Service.
func (*Service) ClockAdvanced ¶
ClockAdvanced expires QUEUED Builds and times out WORKING ones that the advance made due, before returning.
func (*Service) EnvVars ¶
EnvVars implements emu.EnvVarer (FR-CORE-004): the gcloud endpoint override for `gcloud builds`.
func (*Service) Ready ¶
Ready reports whether Build steps can run: a container runtime must be reachable. The result is cached for a few seconds.
func (*Service) Register ¶
Register installs the gRPC service, the REST surface and the log endpoint. 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 ¶
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 ¶
ResourceCounts implements emu.ResourceCounter.
func (*Service) Restore ¶
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.