codebuild

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 23 Imported by: 0

README

CodeBuild

Parity grade: A · SDK aws-sdk-go-v2/service/codebuild@v1.72.4 · last audited 2026-09-04 (0627d5d3)

Coverage

Metric Value
PARITY entries audited 59 (57 ok, 2 partial)
Feature families 4 (4 ok)
Known gaps 5
Deferred items 1
Resource leaks clean
Known gaps
  • DescribeCodeCoverages/DescribeTestCases/GetReportGroupTrend always return empty content (codeCoverages/testCases/stats) because no report actually populates coverage/test-case/trend data anywhere in the backend (reports are seed-only via the AddReportInternal test helper — there is no real CodeBuild API to push test-case/coverage content; on real AWS it's ingested by the managed build agent parsing buildspec reports sections and artifact files, which this emulator's build execution does not model). This remains genuinely correct to leave empty rather than fabricate numbers a client cannot distinguish from real data. Implementing this for real would require modeling report-content ingestion from build artifacts, which is out of scope for this pass. NOTE: as of the 2026-08-11 pass, this is now only a content gap -- the request validation these three ops perform (required fields, ARN existence where real AWS declares it, trendField enum) is complete and correct; see ops: above.
  • FIXED 2026-09-04 (see ListBuildsForProject above): the 2026-08-31 (gopherstack-uox6) ListBuildsForProjectInput.SortOrder>100-builds gap is closed.
  • gopherstack-9ckk (2026-09-11): BuildBatchConfig.CombineArtifacts and .BatchReportMode are carried as passthrough config (round-trip through CreateProject/StartBuildBatch's BuildBatchConfigOverride and back out on BatchGetBuildBatches) but have no behavioral effect -- no real artifact merging (CombineArtifacts) or source-provider status reporting (BatchReportMode, ReportBuildBatchStatusOverride) is simulated anywhere in this service, matching every other CodeBuild op that doesn't talk to a real Git host.
  • gopherstack-9ckk (2026-09-11): build-matrix batch definitions are recognized (selectBatchNodes, batchspec.go) and rejected with InvalidInputException rather than expanded into per-combination BuildGroups -- combinatorial matrix expansion (static/dynamic env + buildspec cross product) was judged not cheap relative to build-list/build-graph, which cover the dependency-graph question this issue was filed to answer. Only StartBuildBatch on a build-matrix-only buildspec is affected; build-list and build-graph are fully implemented.
  • gopherstack-9ckk (2026-09-11): RetryBuildBatch doesn't enforce real AWS's 'only a FAILED batch can be retried' precondition, and doesn't distinguish RetryType (RETRY_ALL_BUILDS vs RETRY_FAILED_BUILDS -- every retry re-runs every group fresh, i.e. always behaves as RETRY_ALL_BUILDS). Enforcing the precondition would have required a failure-injection mechanism this emulator doesn't otherwise have (nothing here ever organically fails a build), and RETRY_FAILED_BUILDS's partial re-run (carrying successful groups forward into PriorBuildSummaryList) is a distinct, non-trivial feature; see RetryBuildBatch above.
Deferred
  • Report-content ingestion (DescribeCodeCoverages/DescribeTestCases/GetReportGroupTrend real data) — see items_still_open above for why this is a substantially larger feature (build artifact parsing), not a quick fix.

More

Documentation

Overview

Package codebuild implements an in-memory AWS CodeBuild backend.

Build batch design: a BuildBatch models the AWS shape (types.BuildBatch): its own Environment/Source/Artifacts/Cache default to the project's and can diverge via StartBuildBatch's *Override fields, exactly like StartBuild's overrides (see StartBuildConfig, builds.go). Its BuildGroups come from the buildspec's `batch:` section (batchspec.go): build-list nodes have no dependencies and all start immediately; build-graph nodes start once their DependsOn groups reach a terminal, non-blocking state. Each started group is a real Build (BuildBatchArn set) created through startBatchChildBuild, sharing the batch's resolved environment layered with the node's own `env:` override.

Dependency ordering rides the same mechanism that already advances plain builds: Builds in this emulator complete only when the Janitor ticks (see janitor.go), not synchronously inside StartBuild. reconcileBatch is called both at StartBuildBatch (to launch initially-eligible groups) and by the Janitor's tick (to advance dependents once their dependencies go terminal) -- BuildGroups themselves carry enough state (Identifier, DependsOn, IgnoreFailure, CurrentBuildSummary) to resume this purely from persisted data, so no additional backend-only scheduling state is needed.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource with the same name already exists.
	ErrAlreadyExists = awserr.New("ResourceAlreadyExistsException", awserr.ErrAlreadyExists)
	// ErrValidation is returned when request input fails validation.
	ErrValidation = awserr.New("InvalidInputException", awserr.ErrInvalidParameter)
)
View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned when Provider.Init is called with a nil AppContext.

Functions

This section is empty.

Types

type AutoRetryConfig

type AutoRetryConfig struct {
	NextAutoRetry     string `json:"nextAutoRetry,omitempty"`
	PreviousAutoRetry string `json:"previousAutoRetry,omitempty"`
	AutoRetryLimit    int32  `json:"autoRetryLimit,omitempty"`
	AutoRetryNumber   int32  `json:"autoRetryNumber,omitempty"`
}

AutoRetryConfig reports a build's auto-retry chain (aws-sdk-go-v2/service/codebuild/types.AutoRetryConfig).

type BatchRestrictions

type BatchRestrictions struct {
	ComputeTypesAllowed  []string `json:"computeTypesAllowed,omitempty"`
	MaximumBuildsAllowed int32    `json:"maximumBuildsAllowed,omitempty"`
}

BatchRestrictions represents restrictions on batch builds.

type Build

type Build struct {
	Source                *ProjectSource      `json:"source,omitempty"`
	Tags                  wireTags            `json:"tags,omitempty"`
	Logs                  *BuildLogs          `json:"logs,omitempty"`
	Artifacts             *ProjectArtifacts   `json:"artifacts,omitempty"`
	Environment           *ProjectEnvironment `json:"environment,omitempty"`
	Cache                 *ProjectCache       `json:"cache,omitempty"`
	VpcConfig             *VpcConfig          `json:"vpcConfig,omitempty"`
	AutoRetryConfig       *AutoRetryConfig    `json:"autoRetryConfig,omitempty"`
	CurrentPhase          string              `json:"currentPhase,omitempty"`
	Initiator             string              `json:"initiator,omitempty"`
	Arn                   string              `json:"arn"`
	ProjectName           string              `json:"projectName"`
	BuildStatus           string              `json:"buildStatus"`
	ServiceRole           string              `json:"serviceRole,omitempty"`
	ResolvedSourceVersion string              `json:"resolvedSourceVersion,omitempty"`
	SourceVersion         string              `json:"sourceVersion,omitempty"`
	ID                    string              `json:"id"`
	EncryptionKey         string              `json:"encryptionKey,omitempty"`
	// BuildBatchArn is set on a build started as one BuildGroup's child of a
	// BuildBatch (aws-sdk-go-v2/service/codebuild/types.Build.BuildBatchArn,
	// types/types.go:67).
	BuildBatchArn           string                 `json:"buildBatchArn,omitempty"`
	Phases                  []BuildPhase           `json:"phases,omitempty"`
	SecondaryArtifacts      []ProjectArtifacts     `json:"secondaryArtifacts,omitempty"`
	SecondarySources        []ProjectSource        `json:"secondarySources,omitempty"`
	SecondarySourceVersions []ProjectSourceVersion `json:"secondarySourceVersions,omitempty"`
	FileSystemLocations     []FileSystemLocation   `json:"fileSystemLocations,omitempty"`
	BuildNumber             int64                  `json:"buildNumber,omitempty"`
	StartTime               float64                `json:"startTime,omitempty"`
	EndTime                 float64                `json:"endTime,omitempty"`
	TimeoutInMinutes        int32                  `json:"timeoutInMinutes,omitempty"`
	QueuedTimeoutInMinutes  int32                  `json:"queuedTimeoutInMinutes,omitempty"`
	BuildComplete           bool                   `json:"buildComplete,omitempty"`
}

Build represents an in-memory AWS CodeBuild build execution. Build represents an in-memory AWS CodeBuild build.

Cache/VpcConfig/FileSystemLocations/SecondaryArtifacts/SecondarySources/ SecondarySourceVersions mirror the project configuration a build actually ran with (codebuild@v1.72.4 deserializers.go's awsAwsjson11_deserializeDocumentBuild), the same way Artifacts/EncryptionKey already do -- StartBuild copies them from the project at build time.

type BuildBatch

type BuildBatch struct {
	Environment             *ProjectEnvironment    `json:"environment,omitempty"`
	Source                  *ProjectSource         `json:"source,omitempty"`
	Artifacts               *ProjectArtifacts      `json:"artifacts,omitempty"`
	Cache                   *ProjectCache          `json:"cache,omitempty"`
	LogConfig               *LogsConfig            `json:"logConfig,omitempty"`
	VpcConfig               *VpcConfig             `json:"vpcConfig,omitempty"`
	BuildBatchConfig        *BuildBatchConfig      `json:"buildBatchConfig,omitempty"`
	Tags                    wireTags               `json:"tags,omitempty"`
	Initiator               string                 `json:"initiator,omitempty"`
	BuildBatchStatus        string                 `json:"buildBatchStatus"`
	EncryptionKey           string                 `json:"encryptionKey,omitempty"`
	ServiceRole             string                 `json:"serviceRole,omitempty"`
	ResolvedSourceVersion   string                 `json:"resolvedSourceVersion,omitempty"`
	SourceVersion           string                 `json:"sourceVersion,omitempty"`
	CurrentPhase            string                 `json:"currentPhase,omitempty"`
	ID                      string                 `json:"id"`
	Arn                     string                 `json:"arn"`
	ProjectName             string                 `json:"projectName"`
	ReportArns              []string               `json:"reportArns,omitempty"`
	SecondarySourceVersions []ProjectSourceVersion `json:"secondarySourceVersions,omitempty"`
	Phases                  []BuildBatchPhase      `json:"phases,omitempty"`
	BuildGroups             []BuildGroup           `json:"buildGroups,omitempty"`
	FileSystemLocations     []FileSystemLocation   `json:"fileSystemLocations,omitempty"`
	SecondaryArtifacts      []ProjectArtifacts     `json:"secondaryArtifacts,omitempty"`
	SecondarySources        []ProjectSource        `json:"secondarySources,omitempty"`
	StartTime               float64                `json:"startTime,omitempty"`
	EndTime                 float64                `json:"endTime,omitempty"`
	BuildBatchNumber        int64                  `json:"buildBatchNumber,omitempty"`
	BuildTimeoutInMinutes   int32                  `json:"buildTimeoutInMinutes,omitempty"`
	QueuedTimeoutInMinutes  int32                  `json:"queuedTimeoutInMinutes,omitempty"`
	Complete                bool                   `json:"complete,omitempty"`
	DebugSessionEnabled     bool                   `json:"debugSessionEnabled,omitempty"`
}

BuildBatch represents an in-memory AWS CodeBuild build batch, modeled on aws-sdk-go-v2/service/codebuild@v1.72.4's types.BuildBatch (types/types.go:302). A batch build is a project's buildspec `batch:` section (build-list or build-graph, see batchspec.go) resolved into BuildGroups, each backed by a real child Build (Build.BuildBatchArn set, started through the same construction StartBuild uses -- see startBatchChildBuild in build_batches.go). Environment/Source/Artifacts/ Cache default to the project's and can diverge via StartBuildBatch's *Override input fields, exactly as StartBuild already does for a plain build (StartBuildConfig, builds.go) -- a batch's environment is therefore not necessarily its project's.

type BuildBatchConfig

type BuildBatchConfig struct {
	ServiceRole      string            `json:"serviceRole,omitempty"`
	BatchReportMode  string            `json:"batchReportMode,omitempty"`
	Restrictions     BatchRestrictions `json:"restrictions,omitzero"`
	TimeoutInMins    int32             `json:"timeoutInMins,omitempty"`
	CombineArtifacts bool              `json:"combineArtifacts,omitempty"`
}

BuildBatchConfig represents batch build configuration for a project.

type BuildBatchPhase

type BuildBatchPhase struct {
	PhaseType         string              `json:"phaseType,omitempty"`
	PhaseStatus       string              `json:"phaseStatus,omitempty"`
	Contexts          []BuildPhaseContext `json:"contexts,omitempty"`
	StartTime         float64             `json:"startTime,omitempty"`
	EndTime           float64             `json:"endTime,omitempty"`
	DurationInSeconds float64             `json:"durationInSeconds,omitempty"`
}

BuildBatchPhase is one phase of a batch build (aws-sdk-go-v2/service/codebuild/types.BuildBatchPhase, types/types.go:464).

type BuildGroup

type BuildGroup struct {
	CurrentBuildSummary   *BuildSummary  `json:"currentBuildSummary,omitempty"`
	Identifier            string         `json:"identifier,omitempty"`
	DependsOn             []string       `json:"dependsOn,omitempty"`
	PriorBuildSummaryList []BuildSummary `json:"priorBuildSummaryList,omitempty"`
	IgnoreFailure         bool           `json:"ignoreFailure,omitempty"`
}

BuildGroup is one node of a batch build's definition (one buildspec `batch:` build-list/build-graph entry) and its current/prior builds (aws-sdk-go-v2/service/codebuild/types.BuildGroup, types/types.go:519).

type BuildLogs

type BuildLogs struct {
	CloudWatchLogsArn string `json:"cloudWatchLogsArn,omitempty"`
	S3LogsArn         string `json:"s3LogsArn,omitempty"`
	GroupName         string `json:"groupName,omitempty"`
	StreamName        string `json:"streamName,omitempty"`
	S3Location        string `json:"s3Location,omitempty"`
	DeepLink          string `json:"deepLink,omitempty"`
}

BuildLogs represents the log locations for a build.

type BuildPhase

type BuildPhase struct {
	PhaseType         string              `json:"phaseType"`
	PhaseStatus       string              `json:"phaseStatus,omitempty"`
	Contexts          []BuildPhaseContext `json:"contexts,omitempty"`
	StartTime         float64             `json:"startTime,omitempty"`
	EndTime           float64             `json:"endTime,omitempty"`
	DurationInSeconds float64             `json:"durationInSeconds,omitempty"`
}

BuildPhase represents a single phase in the build lifecycle.

type BuildPhaseContext

type BuildPhaseContext struct {
	Message    string `json:"message,omitempty"`
	StatusCode string `json:"statusCode,omitempty"`
}

BuildPhaseContext represents a context entry within a build phase.

type BuildStatusConfig

type BuildStatusConfig struct {
	Context   string `json:"context,omitempty"`
	TargetURL string `json:"targetUrl,omitempty"`
}

BuildStatusConfig configures the build status CodeBuild reports back to the source provider (aws-sdk-go-v2/service/codebuild/types.BuildStatusConfig).

type BuildSummary

type BuildSummary struct {
	PrimaryArtifact    *ResolvedArtifact  `json:"primaryArtifact,omitempty"`
	Arn                string             `json:"arn,omitempty"`
	BuildStatus        string             `json:"buildStatus,omitempty"`
	SecondaryArtifacts []ResolvedArtifact `json:"secondaryArtifacts,omitempty"`
	RequestedOn        float64            `json:"requestedOn,omitempty"`
}

BuildSummary summarizes one BuildGroup's current or a prior build (aws-sdk-go-v2/service/codebuild/types.BuildSummary, types/types.go:650).

type CloudWatchLogsConfig

type CloudWatchLogsConfig struct {
	Status     string `json:"status"` // ENABLED|DISABLED
	GroupName  string `json:"groupName,omitempty"`
	StreamName string `json:"streamName,omitempty"`
}

CloudWatchLogsConfig represents CloudWatch Logs configuration.

type CodeCoverage

type CodeCoverage struct {
	ID                       string  `json:"id,omitempty"`
	ReportARN                string  `json:"reportARN,omitempty"`
	FilePath                 string  `json:"filePath,omitempty"`
	LineCoveragePercentage   float64 `json:"lineCoveragePercentage,omitempty"`
	LinesCovered             int32   `json:"linesCovered,omitempty"`
	LinesMissed              int32   `json:"linesMissed,omitempty"`
	BranchCoveragePercentage float64 `json:"branchCoveragePercentage,omitempty"`
	BranchesCovered          int32   `json:"branchesCovered,omitempty"`
	BranchesMissed           int32   `json:"branchesMissed,omitempty"`
	Expired                  float64 `json:"expired,omitempty"`
}

CodeCoverage represents a code coverage entry returned by DescribeCodeCoverages (aws-sdk-go-v2/service/codebuild@v1.72.4/types.CodeCoverage; field-diffed via deserializers.go's awsAwsjson11_deserializeDocumentCodeCoverage).

type CommandExecution

type CommandExecution struct {
	ID                    string `json:"id"`
	SandboxID             string `json:"sandboxId"`
	SandboxArn            string `json:"sandboxArn,omitempty"`
	Command               string `json:"command,omitempty"`
	Type                  string `json:"type,omitempty"` // SHELL
	Status                string `json:"status"`
	StandardOutputContent string `json:"standardOutputContent,omitempty"`
	// StandardErrContent's wire key is "standardErrContent", not
	// "standardErrorContent" -- confirmed via the deserializer case above.
	StandardErrContent string  `json:"standardErrContent,omitempty"`
	ExitCode           string  `json:"exitCode,omitempty"`
	StartTime          float64 `json:"startTime,omitempty"`
	EndTime            float64 `json:"endTime,omitempty"`
}

CommandExecution represents an in-memory AWS CodeBuild command execution. CommandExecution represents an in-memory AWS CodeBuild sandbox command execution. ExitCode is a string on the wire, not a number (aws-sdk-go-v2/service/codebuild@v1.72.4/deserializers.go's awsAwsjson11_deserializeDocumentCommandExecution "exitCode" case: "expected NonEmptyString to be of type string" -- gopherstack previously modeled it as int32, which a real client's decoder would reject outright once a nonzero exit code was ever populated).

type ComputeConfiguration added in v1.2.0

type ComputeConfiguration struct {
	MachineType  string `json:"machineType,omitempty"`
	InstanceType string `json:"instanceType,omitempty"`
	Disk         int64  `json:"disk,omitempty"`
	Memory       int64  `json:"memory,omitempty"`
	VCPU         int64  `json:"vCpu,omitempty"`
}

ComputeConfiguration models the attribute-based-compute or custom-instance-type sizing of a compute fleet (aws-sdk-go-v2/service/ codebuild/types.ComputeConfiguration). Only meaningful when the fleet's computeType is ATTRIBUTE_BASED_COMPUTE or CUSTOM_INSTANCE_TYPE.

type ConfigProvider

type ConfigProvider interface {
	GetCodeBuildSettings() Settings
}

ConfigProvider is a private interface to extract CodeBuild configuration from the abstract AppContext Config.

type CreateFleetOptions added in v1.2.0

type CreateFleetOptions struct {
	Tags                 map[string]string
	ComputeConfiguration *ComputeConfiguration
	ProxyConfiguration   *ProxyConfiguration
	VpcConfig            *VpcConfig
	ScalingConfiguration *ScalingConfiguration
	ComputeType          string
	EnvironmentType      string
	OverflowBehavior     string
	ImageID              string
	FleetServiceRole     string
}

CreateFleetOptions carries CreateFleet's fields beyond the always-required name/baseCapacity.

type DockerServer

type DockerServer struct {
	Status           *DockerServerStatus `json:"status,omitempty"`
	ComputeType      string              `json:"computeType,omitempty"`
	SecurityGroupIDs []string            `json:"securityGroupIds,omitempty"`
}

DockerServer configures a remote Docker server the build environment connects to (aws-sdk-go-v2/service/codebuild/types.DockerServer).

type DockerServerStatus

type DockerServerStatus struct {
	Status  string `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
}

DockerServerStatus reports a remote Docker server's status (aws-sdk-go-v2/service/codebuild/types.DockerServerStatus).

type EnvironmentVariable

type EnvironmentVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Type  string `json:"type,omitempty"` // PLAINTEXT|PARAMETER_STORE|SECRETS_MANAGER
}

EnvironmentVariable represents an environment variable for a build environment.

type FileSystemLocation

type FileSystemLocation struct {
	Identifier   string `json:"identifier,omitempty"`
	Location     string `json:"location,omitempty"`
	Type         string `json:"type,omitempty"` // EFS
	MountPoint   string `json:"mountPoint,omitempty"`
	MountOptions string `json:"mountOptions,omitempty"`
}

FileSystemLocation represents an EFS file system mount for a project.

type Fleet

type Fleet struct {
	Tags                 wireTags              `json:"tags,omitempty"`
	Status               *FleetStatus          `json:"status,omitempty"`
	ScalingConfiguration *ScalingConfiguration `json:"scalingConfiguration,omitempty"`
	ComputeConfiguration *ComputeConfiguration `json:"computeConfiguration,omitempty"`
	ProxyConfiguration   *ProxyConfiguration   `json:"proxyConfiguration,omitempty"`
	VpcConfig            *VpcConfig            `json:"vpcConfig,omitempty"`
	Arn                  string                `json:"arn"`
	ID                   string                `json:"id"`
	Name                 string                `json:"name"`
	FleetServiceRole     string                `json:"fleetServiceRole,omitempty"`
	OverflowBehavior     string                `json:"overflowBehavior,omitempty"` // QUEUE|ON_DEMAND
	ComputeType          string                `json:"computeType,omitempty"`
	EnvironmentType      string                `json:"environmentType,omitempty"`
	ImageID              string                `json:"imageId,omitempty"`
	BaseCapacity         int32                 `json:"baseCapacity"`
	Created              float64               `json:"created,omitempty"`
	LastModified         float64               `json:"lastModified,omitempty"`
}

Fleet represents an in-memory AWS CodeBuild compute fleet.

type FleetProxyRule added in v1.2.0

type FleetProxyRule struct {
	Effect   string   `json:"effect,omitempty"` // ALLOW|DENY
	Type     string   `json:"type,omitempty"`   // DOMAIN|IP
	Entities []string `json:"entities,omitempty"`
}

FleetProxyRule is a single network-access-control rule applied to a reserved-capacity fleet's outgoing traffic (aws-sdk-go-v2/service/ codebuild/types.FleetProxyRule).

type FleetStatus

type FleetStatus struct {
	StatusCode string `json:"statusCode,omitempty"`
	Context    string `json:"context,omitempty"`
	Message    string `json:"message,omitempty"`
}

FleetStatus represents the operational status of a compute fleet.

type GitSubmodulesConfig

type GitSubmodulesConfig struct {
	FetchSubmodules bool `json:"fetchSubmodules"`
}

GitSubmodulesConfig controls whether Git submodules are fetched (aws-sdk-go-v2/service/codebuild/types.GitSubmodulesConfig).

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for CodeBuild operations.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new CodeBuild handler backed by backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the CodeBuild action from the X-Amz-Target header.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(_ *echo.Context) string

ExtractResource extracts the resource identifier from the request (not used for CodeBuild).

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for CodeBuild requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears the handler state by delegating to the backend Reset.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches CodeBuild requests.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker starts the background janitor if configured.

func (*Handler) WithJanitor

func (h *Handler) WithJanitor(interval, buildTTL time.Duration, taskTimeout ...time.Duration) *Handler

WithJanitor attaches a background janitor to the handler.

type InMemoryBackend

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

InMemoryBackend is a thread-safe in-memory store for CodeBuild resources.

Every resource map is a *store.Table[T] (see store_setup.go), with former ARN reverse-lookup maps and per-parent grouping maps replaced by companion *store.Index values. resourcePolicies remains a plain map since its values are strings, not *T.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new backend for the given account and region.

func (*InMemoryBackend) AddBuildBatchInternal

func (b *InMemoryBackend) AddBuildBatchInternal(bb *BuildBatch)

AddBuildBatchInternal seeds a BuildBatch directly into the backend (test helper).

func (*InMemoryBackend) AddCommandExecutionInternal

func (b *InMemoryBackend) AddCommandExecutionInternal(ce *CommandExecution)

AddCommandExecutionInternal seeds a CommandExecution directly into the backend (test helper).

func (*InMemoryBackend) AddReportInternal

func (b *InMemoryBackend) AddReportInternal(r *Report)

AddReportInternal seeds a Report directly into the backend (test helper).

func (*InMemoryBackend) AddSandboxInternal

func (b *InMemoryBackend) AddSandboxInternal(s *Sandbox)

AddSandboxInternal seeds a Sandbox directly into the backend (test helper).

func (*InMemoryBackend) BatchDeleteBuilds

func (b *InMemoryBackend) BatchDeleteBuilds(ids []string) []string

BatchDeleteBuilds deletes builds by ID and returns the IDs that were deleted.

func (*InMemoryBackend) BatchGetBuildBatches

func (b *InMemoryBackend) BatchGetBuildBatches(ids []string) ([]*BuildBatch, []string)

BatchGetBuildBatches returns build batches by ID. Missing IDs are returned separately.

func (*InMemoryBackend) BatchGetBuilds

func (b *InMemoryBackend) BatchGetBuilds(ids []string) ([]*Build, []string)

BatchGetBuilds returns builds by ID or ARN. Missing IDs are returned separately.

func (*InMemoryBackend) BatchGetCommandExecutions

func (b *InMemoryBackend) BatchGetCommandExecutions(sandboxID string, ids []string) ([]*CommandExecution, []string)

BatchGetCommandExecutions returns command executions by ID within a sandbox. Missing IDs are returned separately.

func (*InMemoryBackend) BatchGetFleets

func (b *InMemoryBackend) BatchGetFleets(names []string) ([]*Fleet, []string)

BatchGetFleets returns fleets by name or ARN. Missing names are returned separately.

func (*InMemoryBackend) BatchGetProjects

func (b *InMemoryBackend) BatchGetProjects(names []string) ([]*Project, []string)

BatchGetProjects returns projects by name or ARN. Missing names are returned separately.

func (*InMemoryBackend) BatchGetReportGroups

func (b *InMemoryBackend) BatchGetReportGroups(arns []string) ([]*ReportGroup, []string)

BatchGetReportGroups returns report groups by ARN. Missing ARNs are returned separately.

func (*InMemoryBackend) BatchGetReports

func (b *InMemoryBackend) BatchGetReports(arns []string) ([]*Report, []string)

BatchGetReports returns reports by ARN. Missing ARNs are returned separately.

func (*InMemoryBackend) BatchGetSandboxes

func (b *InMemoryBackend) BatchGetSandboxes(ids []string) ([]*Sandbox, []string)

BatchGetSandboxes returns sandboxes by ID or ARN. Missing IDs are returned separately.

func (*InMemoryBackend) CreateFleet

func (b *InMemoryBackend) CreateFleet(name string, baseCapacity int32, opts CreateFleetOptions) (*Fleet, error)

CreateFleet creates a new compute fleet.

func (*InMemoryBackend) CreateProject

func (b *InMemoryBackend) CreateProject(cfg ProjectConfig) (*Project, error)

CreateProject creates a new CodeBuild project.

func (*InMemoryBackend) CreateReportGroup

func (b *InMemoryBackend) CreateReportGroup(
	name, rtype string, exportConfig ReportExportConfig, tags map[string]string,
) (*ReportGroup, error)

CreateReportGroup creates a new report group.

func (*InMemoryBackend) CreateWebhook

func (b *InMemoryBackend) CreateWebhook(
	projectName, branchFilter, buildType string, filterGroups [][]WebhookFilter, cfg WebhookConfig,
) (*Webhook, error)

CreateWebhook creates a webhook for a CodeBuild project.

Real AWS surfaces the created webhook back on the project itself (the Project.Webhook field returned by BatchGetProjects/GetProject), so the new webhook is mirrored onto the project record here as well as stored in the webhooks table. This emulator doesn't perform a real GitHub/GitLab/Bitbucket round-trip, so webhook creation always succeeds immediately with status ACTIVE (matching the real terminal state a client would eventually observe).

func (*InMemoryBackend) DeleteBuildBatch

func (b *InMemoryBackend) DeleteBuildBatch(id string) error

DeleteBuildBatch removes a build batch by ID. Idempotent: real AWS's DeleteBuildBatch declares no ResourceNotFoundException (botocore codebuild/2016-10-06/service-2.json operations.DeleteBuildBatch.errors: only InvalidInputException), so deleting an already-gone batch is not an error.

func (*InMemoryBackend) DeleteFleet

func (b *InMemoryBackend) DeleteFleet(arnStr string) error

DeleteFleet removes a fleet by ARN or bare name (convenience). Idempotent: real AWS's DeleteFleet declares no ResourceNotFoundException (botocore codebuild/2016-10-06/service-2.json operations.DeleteFleet.errors: only InvalidInputException), so deleting an already-gone fleet is not an error.

func (*InMemoryBackend) DeleteProject

func (b *InMemoryBackend) DeleteProject(name string) error

DeleteProject removes a project by name. Its builds are NOT deleted (api_op_DeleteProject.go: "Deletes a build project. When you delete a project, its builds are not deleted."). Idempotent: real AWS's DeleteProject declares no ResourceNotFoundException (botocore codebuild/2016-10-06/service-2.json operations.DeleteProject.errors: only InvalidInputException), so deleting an already-gone project is not an error.

func (*InMemoryBackend) DeleteReport

func (b *InMemoryBackend) DeleteReport(arnStr string) error

DeleteReport removes a report by ARN. Idempotent: real AWS's DeleteReport declares no ResourceNotFoundException (botocore codebuild/2016-10-06/service-2.json operations.DeleteReport.errors: only InvalidInputException), so deleting an already-gone report is not an error.

func (*InMemoryBackend) DeleteReportGroup

func (b *InMemoryBackend) DeleteReportGroup(arnStr string, deleteReports bool) error

DeleteReportGroup removes a report group by ARN. Idempotent: real AWS's DeleteReportGroup declares no ResourceNotFoundException (same botocore evidence as DeleteReport above), so deleting an already-gone group is not an error. deleteReports mirrors the real DeleteReportGroupInput.DeleteReports member (api_op_DeleteReportGroup.go): if false and the group still has reports, real AWS throws rather than deleting; if true, the group's reports are cascade-deleted along with it.

func (*InMemoryBackend) DeleteResourcePolicy

func (b *InMemoryBackend) DeleteResourcePolicy(resourceArn string) error

DeleteResourcePolicy removes the resource policy for the given ARN (idempotent).

func (*InMemoryBackend) DeleteSourceCredentials

func (b *InMemoryBackend) DeleteSourceCredentials(arnStr string) error

DeleteSourceCredentials removes source credentials by ARN.

func (*InMemoryBackend) DeleteWebhook

func (b *InMemoryBackend) DeleteWebhook(projectName string) error

DeleteWebhook removes the webhook for a project.

func (*InMemoryBackend) DescribeCodeCoverages

func (b *InMemoryBackend) DescribeCodeCoverages(_ string) ([]CodeCoverage, error)

DescribeCodeCoverages returns an empty list; no coverage-content ingestion pipeline exists. Unlike DescribeTestCases/GetReportGroupTrend below, this op's real error set has no ResourceNotFoundException (botocore codebuild/2016-10-06/service-2.json operations.DescribeCodeCoverages.errors: only InvalidInputException), so a nonexistent reportArn is correctly not rejected here.

func (*InMemoryBackend) DescribeTestCases

func (b *InMemoryBackend) DescribeTestCases(reportArn string) ([]TestCase, error)

DescribeTestCases returns an empty list once reportArn is confirmed to exist; no test-case-content ingestion pipeline exists. Real AWS declares ResourceNotFoundException for this op (unlike DescribeCodeCoverages).

func (*InMemoryBackend) GetReportGroupTrend

func (b *InMemoryBackend) GetReportGroupTrend(reportGroupArn string) (map[string]any, error)

GetReportGroupTrend returns an empty stats map once reportGroupArn is confirmed to exist; no report-execution data is modeled. Real AWS declares ResourceNotFoundException for this op.

func (*InMemoryBackend) GetResourcePolicy

func (b *InMemoryBackend) GetResourcePolicy(resourceArn string) (string, error)

GetResourcePolicy returns the resource policy for the given ARN, or ErrNotFound if none set.

func (*InMemoryBackend) ImportSourceCredentials

func (b *InMemoryBackend) ImportSourceCredentials(authType, serverType, token string) (string, error)

ImportSourceCredentials imports source credentials and returns the ARN.

func (*InMemoryBackend) InvalidateProjectCache

func (b *InMemoryBackend) InvalidateProjectCache(projectName string) error

InvalidateProjectCache is a no-op cache invalidation (returns ErrNotFound if project missing).

func (*InMemoryBackend) ListBuildBatches

func (b *InMemoryBackend) ListBuildBatches(statusFilter string) []string

ListBuildBatches returns all build batch IDs in sorted order, optionally filtered by status (empty statusFilter returns every batch).

func (*InMemoryBackend) ListBuildBatchesForProject

func (b *InMemoryBackend) ListBuildBatchesForProject(projectName, statusFilter string) ([]string, error)

ListBuildBatchesForProject returns all batch IDs for a project in sorted order, optionally filtered by status (empty statusFilter returns every batch for the project).

func (*InMemoryBackend) ListBuilds

func (b *InMemoryBackend) ListBuilds() []string

ListBuilds returns all build IDs in the backend in sorted order.

func (*InMemoryBackend) ListBuildsForProject

func (b *InMemoryBackend) ListBuildsForProject(projectName string) ([]string, error)

ListBuildsForProject returns all build IDs for a given project in sorted order.

func (*InMemoryBackend) ListCommandExecutionsForSandbox

func (b *InMemoryBackend) ListCommandExecutionsForSandbox(sandboxID string) ([]*CommandExecution, error)

ListCommandExecutionsForSandbox returns all command executions for a sandbox. Real AWS returns full CommandExecution objects, not just IDs.

func (*InMemoryBackend) ListCuratedEnvironmentImages

func (b *InMemoryBackend) ListCuratedEnvironmentImages() []map[string]any

ListCuratedEnvironmentImages returns a minimal hardcoded list of curated images.

func (*InMemoryBackend) ListFleets

func (b *InMemoryBackend) ListFleets() []string

ListFleets returns all fleet ARNs ordered by fleet name, ascending.

func (*InMemoryBackend) ListFleetsSortedBy added in v1.2.0

func (b *InMemoryBackend) ListFleetsSortedBy(sortBy string) []string

ListFleetsSortedBy returns all fleet ARNs ordered per sortBy (CREATED_TIME|LAST_MODIFIED_TIME|NAME; any other value, including "", defaults to NAME), always ascending. Callers apply sortOrder/pagination on top via [paginateIDs].

func (*InMemoryBackend) ListProjects

func (b *InMemoryBackend) ListProjects() []string

ListProjects returns all project names sorted by name, ascending.

func (*InMemoryBackend) ListProjectsSortedBy added in v1.2.0

func (b *InMemoryBackend) ListProjectsSortedBy(sortBy string) []string

ListProjectsSortedBy returns all project names ordered per sortBy (CREATED_TIME|LAST_MODIFIED_TIME|NAME; any other value, including "", defaults to NAME), always ascending. Callers apply sortOrder/pagination on top via [paginateIDs].

func (*InMemoryBackend) ListReportGroups

func (b *InMemoryBackend) ListReportGroups() []string

ListReportGroups returns all report group ARNs ordered by name, ascending.

func (*InMemoryBackend) ListReportGroupsSortedBy added in v1.2.0

func (b *InMemoryBackend) ListReportGroupsSortedBy(sortBy string) []string

ListReportGroupsSortedBy returns all report group ARNs ordered per sortBy (CREATED_TIME|LAST_MODIFIED_TIME|NAME; any other value, including "", defaults to NAME), always ascending. Callers apply sortOrder/pagination on top via [paginateIDs].

func (*InMemoryBackend) ListReports

func (b *InMemoryBackend) ListReports(statusFilter string) []string

ListReports returns all report ARNs in sorted order, optionally filtered by status (empty statusFilter returns every report).

func (*InMemoryBackend) ListReportsForReportGroup

func (b *InMemoryBackend) ListReportsForReportGroup(reportGroupArn, statusFilter string) ([]string, error)

ListReportsForReportGroup returns all report ARNs for the given report group ARN, optionally filtered by status (empty statusFilter returns every report in the group). Unlike ListReports/ListReportGroups, real AWS declares ResourceNotFoundException for this op (botocore codebuild/2016-10-06/service-2.json operations.ListReportsForReportGroup.errors), so a nonexistent reportGroupArn is rejected here.

func (*InMemoryBackend) ListSandboxes

func (b *InMemoryBackend) ListSandboxes() []string

ListSandboxes returns all sandbox IDs in sorted order.

func (*InMemoryBackend) ListSandboxesForProject

func (b *InMemoryBackend) ListSandboxesForProject(projectName string) ([]string, error)

ListSandboxesForProject returns all sandbox IDs for a project in sorted order.

func (*InMemoryBackend) ListSharedProjects

func (b *InMemoryBackend) ListSharedProjects() []string

ListSharedProjects returns an empty list (no shared projects in emulator).

func (*InMemoryBackend) ListSharedReportGroups

func (b *InMemoryBackend) ListSharedReportGroups() []string

ListSharedReportGroups returns an empty list (no shared report groups in emulator).

func (*InMemoryBackend) ListSourceCredentials

func (b *InMemoryBackend) ListSourceCredentials() []*SourceCredentials

ListSourceCredentials returns all stored source credentials.

func (*InMemoryBackend) PutResourcePolicy

func (b *InMemoryBackend) PutResourcePolicy(resourceArn, policy string) error

PutResourcePolicy stores a resource policy for the given ARN.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the region for this backend instance.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state in the backend, resetting it to a pristine empty state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) RetryBuild

func (b *InMemoryBackend) RetryBuild(id string) (*Build, error)

RetryBuild creates a new build for the same project, inheriting configuration from the existing build (environment, source, artifacts, role, timeouts) matching real AWS semantics. The auto-retry chain (AutoRetryConfig.AutoRetryNumber/PreviousAutoRetry/NextAutoRetry) links the new build back to the one it retried, matching aws-sdk-go-v2/service/codebuild@v1.72.4's types.AutoRetryConfig.

func (*InMemoryBackend) RetryBuildBatch

func (b *InMemoryBackend) RetryBuildBatch(id string) (*BuildBatch, error)

RetryBuildBatch restarts a batch build, reusing the resolved environment/source/artifacts/config of the batch being retried and running its buildspec's batch definition again from scratch.

Disclosed gap: real AWS only allows retrying a FAILED batch, and RetryType (RETRY_ALL_BUILDS vs RETRY_FAILED_BUILDS) selects whether every group or only the failed ones re-run (api_op_RetryBuildBatch.go). Neither is enforced/implemented here -- see PARITY.md.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) StartBuild

func (b *InMemoryBackend) StartBuild(projectName string, cfg StartBuildConfig) (*Build, error)

StartBuild creates a new build for the given project. Env var overrides follow real AWS merge semantics: same-name vars are replaced, new ones appended.

func (*InMemoryBackend) StartBuildBatch

func (b *InMemoryBackend) StartBuildBatch(projectName string, cfg StartBuildBatchConfig) (*BuildBatch, error)

StartBuildBatch creates a new build batch for a project. The project's buildspec (or cfg.BuildspecOverride) must declare a `batch:` section (build-list or build-graph); otherwise this returns the real InvalidInputException (errNoBatchConfig, batchspec.go).

func (*InMemoryBackend) StartCommandExecution

func (b *InMemoryBackend) StartCommandExecution(sandboxID, command, execType string) (*CommandExecution, error)

StartCommandExecution creates a new command execution in a sandbox.

func (*InMemoryBackend) StartSandbox

func (b *InMemoryBackend) StartSandbox(projectName string) (*Sandbox, error)

StartSandbox creates a new sandbox for a project, inheriting its environment/source/VPC/timeout configuration the same way StartBuild inherits them onto a Build (aws-sdk-go-v2/service/codebuild@v1.72.4's types.Sandbox carries the identical set of project-derived fields as types.Build).

func (*InMemoryBackend) StopBuild

func (b *InMemoryBackend) StopBuild(id string) (*Build, error)

StopBuild marks a build as STOPPED.

func (*InMemoryBackend) StopBuildBatch

func (b *InMemoryBackend) StopBuildBatch(id string) (*BuildBatch, error)

StopBuildBatch stops every in-progress child build and marks the batch STOPPED.

func (*InMemoryBackend) StopSandbox

func (b *InMemoryBackend) StopSandbox(id string) (*Sandbox, error)

StopSandbox marks a sandbox as STOPPED.

func (*InMemoryBackend) UpdateFleet

func (b *InMemoryBackend) UpdateFleet(arnStr string, baseCapacity int32, opts UpdateFleetOptions) (*Fleet, error)

UpdateFleet updates a fleet's base capacity and optional fields.

func (*InMemoryBackend) UpdateProject

func (b *InMemoryBackend) UpdateProject(name string, cfg ProjectConfig) (*Project, error)

UpdateProject updates fields on an existing project.

func (*InMemoryBackend) UpdateProjectVisibility

func (b *InMemoryBackend) UpdateProjectVisibility(projectArn, visibility string) (string, error)

UpdateProjectVisibility sets the visibility of a project by ARN. Returns the publicProjectAlias (non-empty only when visibility is PUBLIC_READ).

func (*InMemoryBackend) UpdateReportGroup

func (b *InMemoryBackend) UpdateReportGroup(
	arnStr string,
	exportConfig *ReportExportConfig,
	tags map[string]string,
) (*ReportGroup, error)

UpdateReportGroup updates the export config of a report group.

func (*InMemoryBackend) UpdateWebhook

func (b *InMemoryBackend) UpdateWebhook(
	projectName, branchFilter, buildType string, filterGroups [][]WebhookFilter, cfg WebhookConfig,
) (*Webhook, error)

UpdateWebhook updates the branchFilter, buildType, filterGroups and additive fields of an existing webhook. rotateSecret regenerates Secret and bumps LastModifiedSecret, matching real AWS's rotateSecret request field.

type Janitor

type Janitor struct {
	Backend  *InMemoryBackend
	Interval time.Duration
	BuildTTL time.Duration
	// TaskTimeout bounds each individual janitor task. When non-zero, each task
	// runs with a child context that expires after this duration, preventing a
	// stalled operation from blocking the janitor loop indefinitely.
	TaskTimeout time.Duration
}

Janitor is the CodeBuild background worker that evicts completed builds after a configurable TTL to prevent unbounded growth of in-memory state.

func NewJanitor

func NewJanitor(backend *InMemoryBackend, interval, buildTTL time.Duration) *Janitor

NewJanitor creates a new CodeBuild Janitor for the given backend. Zero values for interval or buildTTL fall back to defaults.

func (*Janitor) Run

func (j *Janitor) Run(ctx context.Context)

Run runs the janitor loop until ctx is cancelled.

func (*Janitor) SweepOnce

func (j *Janitor) SweepOnce(ctx context.Context)

SweepOnce runs a single janitor pass. Exposed for testing.

type LogsConfig

type LogsConfig struct {
	CloudWatchLogs CloudWatchLogsConfig `json:"cloudWatchLogs,omitzero"`
	S3Logs         S3LogsConfig         `json:"s3Logs,omitzero"`
}

LogsConfig represents the logs configuration for a CodeBuild project.

type Project

type Project struct {
	Cache                   *ProjectCache          `json:"cache,omitempty"`
	Tags                    wireTags               `json:"tags,omitempty"`
	Badge                   *ProjectBadge          `json:"badge,omitempty"`
	BuildBatchConfig        *BuildBatchConfig      `json:"buildBatchConfig,omitempty"`
	VpcConfig               *VpcConfig             `json:"vpcConfig,omitempty"`
	LogsConfig              *LogsConfig            `json:"logsConfig,omitempty"`
	Webhook                 *Webhook               `json:"webhook,omitempty"`
	ResourceAccessRole      string                 `json:"resourceAccessRole,omitempty"`
	Description             string                 `json:"description,omitempty"`
	ServiceRole             string                 `json:"serviceRole,omitempty"`
	EncryptionKey           string                 `json:"encryptionKey,omitempty"`
	Arn                     string                 `json:"arn"`
	Visibility              string                 `json:"projectVisibility,omitempty"`
	PublicProjectAlias      string                 `json:"publicProjectAlias,omitempty"`
	Name                    string                 `json:"name"`
	SourceVersion           string                 `json:"sourceVersion,omitempty"`
	Artifacts               ProjectArtifacts       `json:"artifacts"`
	Source                  ProjectSource          `json:"source"`
	SecondarySourceVersions []ProjectSourceVersion `json:"secondarySourceVersions,omitempty"`
	SecondaryArtifacts      []ProjectArtifacts     `json:"secondaryArtifacts,omitempty"`
	SecondarySources        []ProjectSource        `json:"secondarySources,omitempty"`
	FileSystemLocations     []FileSystemLocation   `json:"fileSystemLocations,omitempty"`
	Environment             ProjectEnvironment     `json:"environment"`
	Created                 float64                `json:"created,omitempty"`
	LastModified            float64                `json:"lastModified,omitempty"`
	TimeoutInMinutes        int32                  `json:"timeoutInMinutes,omitempty"`
	QueuedTimeoutInMinutes  int32                  `json:"queuedTimeoutInMinutes,omitempty"`
	ConcurrentBuildLimit    int32                  `json:"concurrentBuildLimit,omitempty"`
	AutoRetryLimit          int32                  `json:"autoRetryLimit,omitempty"`
}

Project represents an in-memory AWS CodeBuild project.

type ProjectArtifacts

type ProjectArtifacts struct {
	Type                 string `json:"type"`
	Location             string `json:"location,omitempty"`
	Path                 string `json:"path,omitempty"`
	NamespaceType        string `json:"namespaceType,omitempty"`
	Name                 string `json:"name,omitempty"`
	Packaging            string `json:"packaging,omitempty"`
	ArtifactIdentifier   string `json:"artifactIdentifier,omitempty"`
	BucketOwnerAccess    string `json:"bucketOwnerAccess,omitempty"`
	OverrideArtifactName bool   `json:"overrideArtifactName,omitempty"`
	EncryptionDisabled   bool   `json:"encryptionDisabled,omitempty"`
}

ProjectArtifacts represents the artifacts configuration for a CodeBuild project.

type ProjectBadge

type ProjectBadge struct {
	BadgeRequestURL string `json:"badgeRequestUrl,omitempty"`
	BadgeEnabled    bool   `json:"badgeEnabled,omitempty"`
}

ProjectBadge represents the build badge for a project.

type ProjectCache

type ProjectCache struct {
	Type     string   `json:"type"` // NO_CACHE|S3|LOCAL
	Location string   `json:"location,omitempty"`
	Modes    []string `json:"modes,omitempty"`
}

ProjectCache represents the cache configuration for a CodeBuild project.

type ProjectConfig

type ProjectConfig struct {
	Cache                   *ProjectCache
	Source                  *ProjectSource
	Artifacts               *ProjectArtifacts
	Tags                    map[string]string
	BuildBatchConfig        *BuildBatchConfig
	VpcConfig               *VpcConfig
	LogsConfig              *LogsConfig
	Environment             *ProjectEnvironment
	BadgeEnabled            *bool
	Description             string
	Name                    string
	EncryptionKey           string
	ServiceRole             string
	ResourceAccessRole      string
	SourceVersion           string
	SecondaryArtifacts      []ProjectArtifacts
	SecondarySourceVersions []ProjectSourceVersion
	SecondarySources        []ProjectSource
	FileSystemLocations     []FileSystemLocation
	TimeoutInMinutes        int32
	QueuedTimeoutInMinutes  int32
	ConcurrentBuildLimit    int32
	AutoRetryLimit          int32
}

ProjectConfig holds all configurable fields for creating or updating a project.

type ProjectEnvironment

type ProjectEnvironment struct {
	RegistryCredential       *RegistryCredential   `json:"registryCredential,omitempty"`
	ComputeConfiguration     *ComputeConfiguration `json:"computeConfiguration,omitempty"`
	DockerServer             *DockerServer         `json:"dockerServer,omitempty"`
	Fleet                    *ProjectFleet         `json:"fleet,omitempty"`
	Type                     string                `json:"type"`
	Image                    string                `json:"image"`
	ComputeType              string                `json:"computeType"`
	Certificate              string                `json:"certificate,omitempty"`
	ImagePullCredentialsType string                `json:"imagePullCredentialsType,omitempty"`
	HostKernel               string                `json:"hostKernel,omitempty"`
	EnvironmentVariables     []EnvironmentVariable `json:"environmentVariables,omitempty"`
	PrivilegedMode           bool                  `json:"privilegedMode,omitempty"`
}

ProjectEnvironment represents the build environment for a CodeBuild project.

type ProjectFleet

type ProjectFleet struct {
	FleetArn string `json:"fleetArn,omitempty"`
}

ProjectFleet identifies a reserved-capacity compute fleet a build environment runs on (aws-sdk-go-v2/service/codebuild/types.ProjectFleet).

type ProjectSource

type ProjectSource struct {
	Auth                SourceAuth           `json:"auth,omitzero"`
	BuildStatusConfig   *BuildStatusConfig   `json:"buildStatusConfig,omitempty"`
	GitSubmodulesConfig *GitSubmodulesConfig `json:"gitSubmodulesConfig,omitempty"`
	Type                string               `json:"type"`
	Location            string               `json:"location,omitempty"`
	Buildspec           string               `json:"buildspec,omitempty"`
	SourceIdentifier    string               `json:"sourceIdentifier,omitempty"`
	GitCloneDepth       int32                `json:"gitCloneDepth,omitempty"`
	InsecureSsl         bool                 `json:"insecureSsl,omitempty"`
	ReportBuildStatus   bool                 `json:"reportBuildStatus,omitempty"`
}

ProjectSource represents the source configuration for a CodeBuild project.

type ProjectSourceVersion

type ProjectSourceVersion struct {
	SourceIdentifier string `json:"sourceIdentifier"`
	SourceVersion    string `json:"sourceVersion"`
}

ProjectSourceVersion pairs a source identifier with a specific version.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS CodeBuild.

func (*Provider) Init

Init initializes the CodeBuild service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ProxyConfiguration added in v1.2.0

type ProxyConfiguration struct {
	DefaultBehavior   string           `json:"defaultBehavior,omitempty"` // ALLOW_ALL|DENY_ALL
	OrderedProxyRules []FleetProxyRule `json:"orderedProxyRules,omitempty"`
}

ProxyConfiguration models a compute fleet's outgoing-traffic network access control (aws-sdk-go-v2/service/codebuild/types.ProxyConfiguration).

type PullRequestBuildPolicy added in v1.2.0

type PullRequestBuildPolicy struct {
	RequiresCommentApproval string   `json:"requiresCommentApproval"`
	ApproverRoles           []string `json:"approverRoles,omitempty"`
}

PullRequestBuildPolicy defines comment-based approval requirements for triggering builds on pull requests.

type RegistryCredential

type RegistryCredential struct {
	Credential         string `json:"credential"`
	CredentialProvider string `json:"credentialProvider"`
}

RegistryCredential holds credentials for a private Docker registry.

type Report

type Report struct {
	Arn            string  `json:"arn"`
	ReportGroupArn string  `json:"reportGroupArn,omitempty"`
	ExecutionID    string  `json:"executionId,omitempty"`
	Type           string  `json:"type,omitempty"`
	Status         string  `json:"status"`
	Created        float64 `json:"created,omitempty"`
	Expired        float64 `json:"expired,omitempty"`
}

Report represents an in-memory AWS CodeBuild report.

type ReportExportConfig

type ReportExportConfig struct {
	ExportConfigType string `json:"exportConfigType,omitempty"`
}

ReportExportConfig represents the export configuration for a CodeBuild report group.

type ReportGroup

type ReportGroup struct {
	Tags         wireTags           `json:"tags,omitempty"`
	ExportConfig ReportExportConfig `json:"exportConfig"`
	Arn          string             `json:"arn"`
	Name         string             `json:"name"`
	Type         string             `json:"type"`
	Status       string             `json:"status"`
	Created      float64            `json:"created,omitempty"`
	LastModified float64            `json:"lastModified,omitempty"`
}

ReportGroup represents an in-memory AWS CodeBuild report group.

type ResolvedArtifact

type ResolvedArtifact struct {
	Identifier string `json:"identifier,omitempty"`
	Location   string `json:"location,omitempty"`
	Type       string `json:"type,omitempty"`
}

ResolvedArtifact identifies a build group's resolved primary or secondary artifact (aws-sdk-go-v2/service/codebuild/types.ResolvedArtifact, types/types.go:2468).

type S3LogsConfig

type S3LogsConfig struct {
	Status             string `json:"status"` // ENABLED|DISABLED
	Location           string `json:"location,omitempty"`
	BucketOwnerAccess  string `json:"bucketOwnerAccess,omitempty"`
	EncryptionDisabled bool   `json:"encryptionDisabled,omitempty"`
}

S3LogsConfig represents S3 log configuration.

type SSMSession

type SSMSession struct {
	SessionID  string `json:"sessionId,omitempty"`
	StreamURL  string `json:"streamUrl,omitempty"`
	TokenValue string `json:"tokenValue,omitempty"`
}

SSMSession is the Session Manager session info StartSandboxConnection returns (aws-sdk-go-v2/service/codebuild@v1.72.4 types.SSMSession, types/types.go:2805 -- SessionId/StreamUrl/TokenValue). No real Session Manager streaming is simulated; the values are synthesized placeholders so a real client at least decodes the documented shape instead of a permanently-nil SsmSession.

type Sandbox

type Sandbox struct {
	Environment             *ProjectEnvironment    `json:"environment,omitempty"`
	Source                  *ProjectSource         `json:"source,omitempty"`
	VpcConfig               *VpcConfig             `json:"vpcConfig,omitempty"`
	ID                      string                 `json:"id"`
	Arn                     string                 `json:"arn"`
	ProjectName             string                 `json:"projectName,omitempty"`
	Status                  string                 `json:"status"` // QUEUED|PROVISIONING|READY|STARTING|STOPPED
	ServiceRole             string                 `json:"serviceRole,omitempty"`
	EncryptionKey           string                 `json:"encryptionKey,omitempty"`
	SourceVersion           string                 `json:"sourceVersion,omitempty"`
	SecondarySources        []ProjectSource        `json:"secondarySources,omitempty"`
	SecondarySourceVersions []ProjectSourceVersion `json:"secondarySourceVersions,omitempty"`
	FileSystemLocations     []FileSystemLocation   `json:"fileSystemLocations,omitempty"`
	StartTime               float64                `json:"startTime,omitempty"`
	EndTime                 float64                `json:"endTime,omitempty"`
	TimeoutInMinutes        int32                  `json:"timeoutInMinutes,omitempty"`
	QueuedTimeoutInMinutes  int32                  `json:"queuedTimeoutInMinutes,omitempty"`
}

Sandbox represents an in-memory AWS CodeBuild sandbox. Like Build, a sandbox inherits its environment/source/VPC/timeout configuration from the project it starts against (aws-sdk-go-v2/service/codebuild@v1.72.4/ deserializers.go's awsAwsjson11_deserializeDocumentSandbox: environment/ source/sourceVersion/secondarySources/secondarySourceVersions/vpcConfig/ fileSystemLocations/encryptionKey/serviceRole/queuedTimeoutInMinutes/ timeoutInMinutes are all real fields on the response). CurrentSession and LogConfig are deliberately not modeled: StartSandboxConnection already documents (PARITY.md) that a real interactive terminal session isn't simulated, and LogConfig has the same no-observable-effect reasoning as Build's LogsConfigOverride (see StartBuildConfig's doc comment).

type ScalingConfiguration

type ScalingConfiguration struct {
	ScalingType                  string                        `json:"scalingType,omitempty"`
	TargetTrackingScalingConfigs []TargetTrackingScalingConfig `json:"targetTrackingScalingConfigs,omitempty"`
	MaxCapacity                  int32                         `json:"maxCapacity,omitempty"`
	DesiredCapacity              int32                         `json:"desiredCapacity,omitempty"`
}

ScalingConfiguration represents the scaling settings for a compute fleet.

DesiredCapacity is only meaningful in a response (types. ScalingConfigurationOutput) -- real AWS's request shape (types. ScalingConfigurationInput) has no such field, since the desired capacity is computed by the service, not supplied by the caller. Callers building an UpdateFleet/CreateFleet request should leave it zero; it is ignored on input and populated on output.

type ScopeConfiguration added in v1.2.0

type ScopeConfiguration struct {
	Name   string `json:"name"`
	Domain string `json:"domain,omitempty"`
	Scope  string `json:"scope"`
}

ScopeConfiguration is the scope configuration for a global or organization webhook.

type Settings

type Settings struct {
	JanitorInterval time.Duration `json:"janitor_interval" env:"CODEBUILD_JANITOR_INTERVAL" default:"1m"  help:"Janitor tick interval."` //nolint:lll // Kong struct tag makes this line long
	BuildTTL        time.Duration ``                                                                                                     //nolint:lll // Kong struct tag makes this line long
	/* 127-byte string literal not displayed */
}

Settings holds service-level configuration for the CodeBuild backend. Fields are picked up by the Kong CLI parser when this struct is embedded in the root CLI command.

type SourceAuth

type SourceAuth struct {
	Type     string `json:"type,omitempty"`
	Resource string `json:"resource,omitempty"`
}

SourceAuth represents authentication for a CodeBuild source.

type SourceCredentials

type SourceCredentials struct {
	Arn        string `json:"arn"`
	ServerType string `json:"serverType"`
	AuthType   string `json:"authType"`
}

SourceCredentials represents imported source credentials.

type StartBuildBatchConfig

type StartBuildBatchConfig struct {
	ArtifactsOverride                *ProjectArtifacts
	BuildBatchConfigOverride         *BuildBatchConfig
	CacheOverride                    *ProjectCache
	RegistryCredentialOverride       *RegistryCredential
	SourceAuthOverride               *SourceAuth
	GitSubmodulesConfigOverride      *GitSubmodulesConfig
	InsecureSslOverride              *bool
	ReportBuildBatchStatusOverride   *bool
	PrivilegedModeOverride           *bool
	GitCloneDepthOverride            *int32
	BuildTimeoutInMinutesOverride    *int32
	QueuedTimeoutInMinutesOverride   *int32
	ServiceRoleOverride              string
	ComputeTypeOverride              string
	SourceVersion                    string
	SourceTypeOverride               string
	SourceLocationOverride           string
	EnvironmentTypeOverride          string
	CertificateOverride              string
	ImagePullCredentialsTypeOverride string
	ImageOverride                    string
	EncryptionKeyOverride            string
	BuildspecOverride                string
	SecondaryArtifactsOverride       []ProjectArtifacts
	SecondarySourcesOverride         []ProjectSource
	SecondarySourcesVersionOverride  []ProjectSourceVersion
	EnvVarsOverride                  []EnvironmentVariable
	DebugSessionEnabled              bool
}

StartBuildBatchConfig holds override parameters for a StartBuildBatch call, mirroring aws-sdk-go-v2/service/codebuild@v1.72.4's api_op_StartBuildBatch.go StartBuildBatchInput. IdempotencyToken and LogsConfigOverride are skipped for the same reasons StartBuildConfig skips them (see builds.go). StartBuildBatchInput has no FleetOverride, HostKernelOverride, or AutoRetryLimitOverride -- api_op_StartBuildBatch.go simply doesn't declare them (unlike StartBuildInput).

type StartBuildConfig

type StartBuildConfig struct {
	ArtifactsOverride                *ProjectArtifacts
	CacheOverride                    *ProjectCache
	RegistryCredentialOverride       *RegistryCredential
	FleetOverride                    *ProjectFleet
	SourceAuthOverride               *SourceAuth
	BuildStatusConfigOverride        *BuildStatusConfig
	GitSubmodulesConfigOverride      *GitSubmodulesConfig
	InsecureSslOverride              *bool
	ReportBuildStatusOverride        *bool
	PrivilegedModeOverride           *bool
	GitCloneDepthOverride            *int32
	AutoRetryLimitOverride           *int32
	ServiceRoleOverride              string
	HostKernelOverride               string
	ComputeTypeOverride              string
	SourceVersion                    string
	SourceTypeOverride               string
	SourceLocationOverride           string
	EnvironmentTypeOverride          string
	CertificateOverride              string
	ImagePullCredentialsTypeOverride string
	ImageOverride                    string
	EncryptionKeyOverride            string
	BuildspecOverride                string
	SecondaryArtifactsOverride       []ProjectArtifacts
	SecondarySourcesOverride         []ProjectSource
	SecondarySourcesVersionOverride  []ProjectSourceVersion
	EnvVarsOverride                  []EnvironmentVariable
	TimeoutInMinutesOverride         int32
	QueuedTimeoutInMinutesOverride   int32
	DebugSessionEnabled              bool
}

StartBuildConfig holds override parameters for a StartBuild call, mirroring aws-sdk-go-v2/service/codebuild@v1.72.4/api_op_StartBuild.go's StartBuildInput. IdempotencyToken and LogsConfigOverride are intentionally not modeled: this emulator does not deduplicate build submissions, and neither field has an observable effect through any real read op (Build has no logsConfig field of its own -- LogsConfigOverride only affects where a real build's logs are delivered, which this emulator's Build.Logs, a distinct always-nil field pending real log delivery, does not simulate).

type TargetTrackingScalingConfig added in v1.2.0

type TargetTrackingScalingConfig struct {
	MetricType  string  `json:"metricType,omitempty"` // FLEET_UTILIZATION_RATE
	TargetValue float64 `json:"targetValue,omitempty"`
}

TargetTrackingScalingConfig defines when a new instance is auto-scaled into a compute fleet (aws-sdk-go-v2/service/codebuild/types. TargetTrackingScalingConfiguration).

type TestCase

type TestCase struct {
	ReportArn             string  `json:"reportArn,omitempty"`
	TestRawDataPath       string  `json:"testRawDataPath,omitempty"`
	Prefix                string  `json:"prefix,omitempty"`
	Name                  string  `json:"name,omitempty"`
	Status                string  `json:"status,omitempty"`
	Message               string  `json:"message,omitempty"`
	TestSuiteName         string  `json:"testSuiteName,omitempty"`
	DurationInNanoSeconds int64   `json:"durationInNanoSeconds,omitempty"`
	Expired               float64 `json:"expired,omitempty"`
}

TestCase represents a test case entry returned by DescribeTestCases (aws-sdk-go-v2/service/codebuild@v1.72.4/types.TestCase).

type UpdateFleetOptions added in v1.2.0

type UpdateFleetOptions struct {
	ComputeConfiguration *ComputeConfiguration
	ProxyConfiguration   *ProxyConfiguration
	VpcConfig            *VpcConfig
	ScalingConfiguration *ScalingConfiguration
	Tags                 map[string]string
	ComputeType          string
	EnvironmentType      string
	OverflowBehavior     string
	ImageID              string
	FleetServiceRole     string
}

UpdateFleetOptions carries UpdateFleet's optional fields. An empty string leaves the corresponding Fleet field unchanged (real AWS's UpdateFleet only updates members actually present in the request; gopherstack approximates that with "non-empty overwrites", the same convention already used by Project's optional-field updates -- see applyProjectOptionalFields). ComputeConfiguration/ProxyConfiguration/VpcConfig/ScalingConfiguration follow the same convention: a non-nil pointer overwrites, nil leaves the existing value unchanged (real UpdateFleetInput only mutates members actually present in the request).

type VpcConfig

type VpcConfig struct {
	VpcID            string   `json:"vpcId,omitempty"`
	Subnets          []string `json:"subnets,omitempty"`
	SecurityGroupIDs []string `json:"securityGroupIds,omitempty"`
}

VpcConfig represents VPC configuration for a CodeBuild project.

type Webhook

type Webhook struct {
	ManualCreation         *bool                   `json:"manualCreation,omitempty"`
	PullRequestBuildPolicy *PullRequestBuildPolicy `json:"pullRequestBuildPolicy,omitempty"`
	ScopeConfiguration     *ScopeConfiguration     `json:"scopeConfiguration,omitempty"`
	ProjectName            string                  `json:"projectName"`
	URL                    string                  `json:"url,omitempty"`
	BranchFilter           string                  `json:"branchFilter,omitempty"`
	BuildType              string                  `json:"buildType,omitempty"`
	PayloadURL             string                  `json:"payloadUrl,omitempty"`
	Secret                 string                  `json:"secret,omitempty"`
	Status                 string                  `json:"status,omitempty"`
	StatusMessage          string                  `json:"statusMessage,omitempty"`
	FilterGroups           [][]WebhookFilter       `json:"filterGroups,omitempty"`
	LastModifiedSecret     float64                 `json:"lastModifiedSecret,omitempty"`
}

Webhook represents an in-memory AWS CodeBuild webhook.

type WebhookConfig added in v1.2.0

type WebhookConfig struct {
	ManualCreation         *bool
	PullRequestBuildPolicy *PullRequestBuildPolicy
	ScopeConfiguration     *ScopeConfiguration
	RotateSecret           bool
}

WebhookConfig holds the configurable, additive fields accepted by CreateWebhook/UpdateWebhook beyond branchFilter/buildType/filterGroups.

type WebhookFilter

type WebhookFilter struct {
	Type                  string `json:"type"`
	Pattern               string `json:"pattern"`
	ExcludeMatchedPattern bool   `json:"excludeMatchedPattern,omitempty"`
}

WebhookFilter represents a single filter criterion in a webhook filter group.

Jump to

Keyboard shortcuts

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