Help us shape the future of Go! Take the 2026 Go Developer Survey

codebuild

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package codebuild emulates AWS CodeBuild over JSON 1.1: projects (with report groups and webhooks as metadata) and builds that run real buildspecs in Docker, with the source from S3, git or none, logs in CloudWatch Logs and artifacts in S3.

Index

Constants

View Source
const NoDocker = "pogi: Docker is not available, so builds cannot run"

NoDocker is the phase context of builds that cannot run.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifacts

type Artifacts struct {
	Type          string `json:"type"`
	Location      string `json:"location,omitempty"`
	Path          string `json:"path,omitempty"`
	Name          string `json:"name,omitempty"`
	NamespaceType string `json:"namespaceType,omitempty"`
	Packaging     string `json:"packaging,omitempty"`
}

Artifacts is where a project's output goes.

type Build

type Build struct {
	ID                     string      `json:"id"`
	Arn                    string      `json:"arn"`
	BuildNumber            int64       `json:"buildNumber"`
	StartTime              core.Time   `json:"startTime"`
	EndTime                *core.Time  `json:"endTime,omitempty"`
	CurrentPhase           string      `json:"currentPhase"`
	BuildStatus            string      `json:"buildStatus"`
	BuildComplete          bool        `json:"buildComplete"`
	ProjectName            string      `json:"projectName"`
	SourceVersion          string      `json:"sourceVersion,omitempty"`
	ResolvedSourceVersion  string      `json:"resolvedSourceVersion,omitempty"`
	Phases                 []*Phase    `json:"phases"`
	Source                 Source      `json:"source"`
	Environment            Environment `json:"environment"`
	Artifacts              *Output     `json:"artifacts,omitempty"`
	Logs                   *Logs       `json:"logs,omitempty"`
	ServiceRole            string      `json:"serviceRole,omitempty"`
	TimeoutInMinutes       int         `json:"timeoutInMinutes"`
	QueuedTimeoutInMinutes int         `json:"queuedTimeoutInMinutes"`
	Initiator              string      `json:"initiator,omitempty"`
	EncryptionKey          string      `json:"encryptionKey,omitempty"`
}

Build is one run of a project, in the API's shape.

type Context

type Context struct {
	StatusCode string `json:"statusCode"`
	Message    string `json:"message"`
}

Context says why a phase ended as it did.

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Type  string `json:"type,omitempty"`
}

EnvVar is an environment variable: PLAINTEXT, PARAMETER_STORE or SECRETS_MANAGER.

type Environment

type Environment struct {
	Type                     string   `json:"type"`
	Image                    string   `json:"image"`
	ComputeType              string   `json:"computeType"`
	EnvironmentVariables     []EnvVar `json:"environmentVariables,omitempty"`
	PrivilegedMode           bool     `json:"privilegedMode"`
	ImagePullCredentialsType string   `json:"imagePullCredentialsType,omitempty"`
}

Environment is a build's container.

type Logs

type Logs struct {
	GroupName  string `json:"groupName"`
	StreamName string `json:"streamName"`
	DeepLink   string `json:"deepLink"`
	Arn        string `json:"cloudWatchLogsArn"`
}

Logs is where a build logs to.

type Output

type Output struct {
	Location  string `json:"location"`
	Sha256sum string `json:"sha256sum,omitempty"`
	Md5sum    string `json:"md5sum,omitempty"`
}

Output is where a build's artifacts went.

type Phase

type Phase struct {
	Type     string     `json:"phaseType"`
	Status   string     `json:"phaseStatus,omitempty"`
	Start    core.Time  `json:"startTime"`
	End      *core.Time `json:"endTime,omitempty"`
	Duration *int64     `json:"durationInSeconds,omitempty"`
	Contexts []Context  `json:"contexts,omitempty"`
}

Phase is one step of a build.

type Project

type Project map[string]any

Project is a build project as the API shows it: as given, plus what CodeBuild fills in.

type Service

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

Service is the CodeBuild emulator.

func New

func New(hub *core.Hub) *Service

New creates the CodeBuild service.

func (*Service) Close

func (s *Service) Close() error

Close stops the builds still running, removing their containers.

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

func (*Service) Load

func (s *Service) Load(b []byte) error

Load restores state; builds that were running have lost their containers and fail.

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Source

type Source struct {
	Type          string `json:"type"`
	Location      string `json:"location,omitempty"`
	Buildspec     string `json:"buildspec,omitempty"`
	GitCloneDepth int    `json:"gitCloneDepth,omitempty"`
	InsecureSsl   bool   `json:"insecureSsl"`
}

Source is where a build's source comes from.

Jump to

Keyboard shortcuts

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