codebuild

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 21 Imported by: 0

README

CodeBuild

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

Coverage

Metric Value
Operations audited 59 (55 ok, 4 partial)
Feature families 4 (4 ok)
Known gaps none
Deferred items 1
Resource leaks clean
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

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 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                   map[string]string   `json:"tags,omitempty"`
	Logs                   *BuildLogs          `json:"logs,omitempty"`
	Artifacts              *ProjectArtifacts   `json:"artifacts,omitempty"`
	Environment            *ProjectEnvironment `json:"environment,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"`
	ID                     string              `json:"id"`
	EncryptionKey          string              `json:"encryptionKey,omitempty"`
	Phases                 []BuildPhase        `json:"phases,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.

type BuildBatch

type BuildBatch struct {
	Tags             map[string]string `json:"tags,omitempty"`
	ID               string            `json:"id"`
	Arn              string            `json:"arn"`
	ProjectName      string            `json:"projectName"`
	BuildBatchStatus string            `json:"buildBatchStatus"`
	StartTime        float64           `json:"startTime,omitempty"`
	EndTime          float64           `json:"endTime,omitempty"`
}

BuildBatch represents an in-memory AWS CodeBuild build batch.

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 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 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 {
	FilePath       string  `json:"filePath,omitempty"`
	BranchCoverage float64 `json:"branchCoverage,omitempty"`
	LineCoverage   float64 `json:"lineCoverage,omitempty"`
}

CodeCoverage represents a code coverage entry returned by DescribeCodeCoverages.

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"`
	StandardErrorContent  string  `json:"standardErrorContent,omitempty"`
	ExitCode              int32   `json:"exitCode,omitempty"`
	StartTime             float64 `json:"startTime,omitempty"`
	EndTime               float64 `json:"endTime,omitempty"`
}

CommandExecution represents an in-memory AWS CodeBuild command execution.

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 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                 map[string]string     `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 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.

func (*InMemoryBackend) DeleteFleet

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

DeleteFleet removes a fleet by ARN.

func (*InMemoryBackend) DeleteProject

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

DeleteProject removes a project by name and all builds associated with it.

func (*InMemoryBackend) DeleteReport

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

DeleteReport removes a report by ARN.

func (*InMemoryBackend) DeleteReportGroup

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

DeleteReportGroup removes a report group by ARN.

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 state needed).

func (*InMemoryBackend) DescribeTestCases

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

DescribeTestCases returns an empty list (no state needed).

func (*InMemoryBackend) GetReportGroupTrend

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

GetReportGroupTrend returns an empty stats map (no state needed).

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

ListReportsForReportGroup returns all report ARNs for the given report group ARN, optionally filtered by status (empty statusFilter returns every report in the group).

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.

func (*InMemoryBackend) RetryBuildBatch

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

RetryBuildBatch creates a new build batch with the same project as an existing one.

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) (*BuildBatch, error)

StartBuildBatch creates a new build batch for a project.

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.

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 marks a build batch as 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) (*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                    map[string]string      `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
	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"`
	Type                     string                `json:"type"`
	Image                    string                `json:"image"`
	ComputeType              string                `json:"computeType"`
	Certificate              string                `json:"certificate,omitempty"`
	ImagePullCredentialsType string                `json:"imagePullCredentialsType,omitempty"`
	EnvironmentVariables     []EnvironmentVariable `json:"environmentVariables,omitempty"`
	PrivilegedMode           bool                  `json:"privilegedMode,omitempty"`
}

ProjectEnvironment represents the build environment for a CodeBuild project.

type ProjectSource

type ProjectSource struct {
	Auth              SourceAuth `json:"auth,omitzero"`
	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         map[string]string  `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 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 Sandbox

type Sandbox struct {
	ID          string  `json:"id"`
	Arn         string  `json:"arn"`
	ProjectName string  `json:"projectName,omitempty"`
	Status      string  `json:"status"` // QUEUED|PROVISIONING|READY|STARTING|STOPPED
	StartTime   float64 `json:"startTime,omitempty"`
	EndTime     float64 `json:"endTime,omitempty"`
}

Sandbox represents an in-memory AWS CodeBuild sandbox.

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 StartBuildConfig

type StartBuildConfig struct {
	BuildspecOverride        string
	ComputeTypeOverride      string
	ImageOverride            string
	ServiceRoleOverride      string
	SourceVersion            string
	EnvVarsOverride          []EnvironmentVariable
	TimeoutInMinutesOverride int32
	DebugSessionEnabled      bool
}

StartBuildConfig holds override parameters for a StartBuild call.

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 {
	Name     string  `json:"name,omitempty"`
	Status   string  `json:"status,omitempty"`
	Duration float64 `json:"duration,omitempty"`
}

TestCase represents a test case entry returned by DescribeTestCases.

type UpdateFleetOptions added in v1.2.0

type UpdateFleetOptions struct {
	ComputeConfiguration *ComputeConfiguration
	ProxyConfiguration   *ProxyConfiguration
	VpcConfig            *VpcConfig
	ScalingConfiguration *ScalingConfiguration
	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