Documentation
¶
Index ¶
- Variables
- type BatchRestrictions
- type Build
- type BuildBatch
- type BuildBatchConfig
- type BuildLogs
- type BuildPhase
- type BuildPhaseContext
- type CloudWatchLogsConfig
- type CodeCoverage
- type CommandExecution
- type ConfigProvider
- type EnvironmentVariable
- type FileSystemLocation
- type Fleet
- type FleetStatus
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(_ *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- func (h *Handler) WithJanitor(interval, buildTTL time.Duration, taskTimeout ...time.Duration) *Handler
- type InMemoryBackend
- func (b *InMemoryBackend) AddBuildBatchInternal(bb *BuildBatch)
- func (b *InMemoryBackend) AddCommandExecutionInternal(ce *CommandExecution)
- func (b *InMemoryBackend) AddReportInternal(r *Report)
- func (b *InMemoryBackend) AddSandboxInternal(s *Sandbox)
- func (b *InMemoryBackend) BatchDeleteBuilds(ids []string) []string
- func (b *InMemoryBackend) BatchGetBuildBatches(ids []string) ([]*BuildBatch, []string)
- func (b *InMemoryBackend) BatchGetBuilds(ids []string) ([]*Build, []string)
- func (b *InMemoryBackend) BatchGetCommandExecutions(sandboxID string, ids []string) ([]*CommandExecution, []string)
- func (b *InMemoryBackend) BatchGetFleets(names []string) ([]*Fleet, []string)
- func (b *InMemoryBackend) BatchGetProjects(names []string) ([]*Project, []string)
- func (b *InMemoryBackend) BatchGetReportGroups(arns []string) ([]*ReportGroup, []string)
- func (b *InMemoryBackend) BatchGetReports(arns []string) ([]*Report, []string)
- func (b *InMemoryBackend) BatchGetSandboxes(ids []string) ([]*Sandbox, []string)
- func (b *InMemoryBackend) CreateFleet(name string, baseCapacity int32, computeType, environmentType string, ...) (*Fleet, error)
- func (b *InMemoryBackend) CreateProject(cfg ProjectConfig) (*Project, error)
- func (b *InMemoryBackend) CreateReportGroup(name, rtype string, exportConfig ReportExportConfig, tags map[string]string) (*ReportGroup, error)
- func (b *InMemoryBackend) CreateWebhook(projectName, branchFilter, buildType string, filterGroups [][]WebhookFilter) (*Webhook, error)
- func (b *InMemoryBackend) DeleteBuildBatch(id string) error
- func (b *InMemoryBackend) DeleteFleet(arnStr string) error
- func (b *InMemoryBackend) DeleteProject(name string) error
- func (b *InMemoryBackend) DeleteReport(arnStr string) error
- func (b *InMemoryBackend) DeleteReportGroup(arnStr string) error
- func (b *InMemoryBackend) DeleteResourcePolicy(resourceArn string) error
- func (b *InMemoryBackend) DeleteSourceCredentials(arnStr string) error
- func (b *InMemoryBackend) DeleteWebhook(projectName string) error
- func (b *InMemoryBackend) DescribeCodeCoverages(_ string) ([]CodeCoverage, error)
- func (b *InMemoryBackend) DescribeTestCases(_ string) ([]TestCase, error)
- func (b *InMemoryBackend) GetReportGroupTrend(_ string) (map[string]any, error)
- func (b *InMemoryBackend) GetResourcePolicy(resourceArn string) (string, error)
- func (b *InMemoryBackend) ImportSourceCredentials(authType, serverType, token string) (string, error)
- func (b *InMemoryBackend) InvalidateProjectCache(projectName string) error
- func (b *InMemoryBackend) ListBuildBatches() []string
- func (b *InMemoryBackend) ListBuildBatchesForProject(projectName string) ([]string, error)
- func (b *InMemoryBackend) ListBuilds() []string
- func (b *InMemoryBackend) ListBuildsForProject(projectName string) ([]string, error)
- func (b *InMemoryBackend) ListCommandExecutionsForSandbox(sandboxID string) ([]*CommandExecution, error)
- func (b *InMemoryBackend) ListCuratedEnvironmentImages() []map[string]any
- func (b *InMemoryBackend) ListFleets() []string
- func (b *InMemoryBackend) ListProjects() []string
- func (b *InMemoryBackend) ListReportGroups() []string
- func (b *InMemoryBackend) ListReports() []string
- func (b *InMemoryBackend) ListReportsForReportGroup(reportGroupArn string) []string
- func (b *InMemoryBackend) ListSandboxes() []string
- func (b *InMemoryBackend) ListSandboxesForProject(projectName string) ([]string, error)
- func (b *InMemoryBackend) ListSharedProjects() []string
- func (b *InMemoryBackend) ListSharedReportGroups() []string
- func (b *InMemoryBackend) ListSourceCredentials() []*SourceCredentials
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) PutResourcePolicy(resourceArn, policy string) error
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RetryBuild(id string) (*Build, error)
- func (b *InMemoryBackend) RetryBuildBatch(id string) (*BuildBatch, error)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartBuild(projectName string, cfg StartBuildConfig) (*Build, error)
- func (b *InMemoryBackend) StartBuildBatch(projectName string) (*BuildBatch, error)
- func (b *InMemoryBackend) StartCommandExecution(sandboxID, command, execType string) (*CommandExecution, error)
- func (b *InMemoryBackend) StartSandbox(projectName string) (*Sandbox, error)
- func (b *InMemoryBackend) StopBuild(id string) (*Build, error)
- func (b *InMemoryBackend) StopBuildBatch(id string) (*BuildBatch, error)
- func (b *InMemoryBackend) StopSandbox(id string) (*Sandbox, error)
- func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateFleet(arnStr string, baseCapacity int32) (*Fleet, error)
- func (b *InMemoryBackend) UpdateProject(name string, cfg ProjectConfig) (*Project, error)
- func (b *InMemoryBackend) UpdateProjectVisibility(projectArn, visibility string) (string, error)
- func (b *InMemoryBackend) UpdateReportGroup(arnStr string, exportConfig *ReportExportConfig) (*ReportGroup, error)
- func (b *InMemoryBackend) UpdateWebhook(projectName, branchFilter, buildType string, filterGroups [][]WebhookFilter) (*Webhook, error)
- type Janitor
- type LogsConfig
- type Project
- type ProjectArtifacts
- type ProjectBadge
- type ProjectCache
- type ProjectConfig
- type ProjectEnvironment
- type ProjectSource
- type ProjectSourceVersion
- type Provider
- type RegistryCredential
- type Report
- type ReportExportConfig
- type ReportGroup
- type S3LogsConfig
- type Sandbox
- type ScalingConfiguration
- type Settings
- type SourceAuth
- type SourceCredentials
- type StartBuildConfig
- type TestCase
- type VpcConfig
- type Webhook
- type WebhookFilter
Constants ¶
This section is empty.
Variables ¶
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) )
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 ConfigProvider ¶
type ConfigProvider interface {
GetCodeBuildSettings() Settings
}
ConfigProvider is a private interface to extract CodeBuild configuration from the abstract AppContext Config.
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"`
Arn string `json:"arn"`
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"`
BaseCapacity int32 `json:"baseCapacity"`
Created float64 `json:"created,omitempty"`
LastModified float64 `json:"lastModified,omitempty"`
}
Fleet represents an in-memory AWS CodeBuild compute fleet.
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 ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the CodeBuild action from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource identifier from the request (not used for CodeBuild).
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority returns the routing priority.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears the handler state by delegating to the backend Reset.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches CodeBuild requests.
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend.
func (*Handler) StartWorker ¶
StartWorker starts the background janitor if configured.
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, computeType, environmentType string, tags map[string]string, ) (*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, ) (*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.
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() []string
ListBuildBatches returns all build batch IDs in sorted order.
func (*InMemoryBackend) ListBuildBatchesForProject ¶
func (b *InMemoryBackend) ListBuildBatchesForProject(projectName string) ([]string, error)
ListBuildBatchesForProject returns all batch IDs for a project in sorted order.
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 in sorted order.
func (*InMemoryBackend) ListProjects ¶
func (b *InMemoryBackend) ListProjects() []string
ListProjects returns all project names in sorted order.
func (*InMemoryBackend) ListReportGroups ¶
func (b *InMemoryBackend) ListReportGroups() []string
ListReportGroups returns all report group ARNs in sorted order.
func (*InMemoryBackend) ListReports ¶
func (b *InMemoryBackend) ListReports() []string
ListReports returns all report ARNs in sorted order.
func (*InMemoryBackend) ListReportsForReportGroup ¶
func (b *InMemoryBackend) ListReportsForReportGroup(reportGroupArn string) []string
ListReportsForReportGroup returns all report ARNs for the given report group ARN.
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) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource returns the tags for a CodeBuild resource by ARN.
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) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
TagResource adds or updates tags on a CodeBuild resource.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
UntagResource removes tags from a CodeBuild resource.
func (*InMemoryBackend) UpdateFleet ¶
func (b *InMemoryBackend) UpdateFleet(arnStr string, baseCapacity int32) (*Fleet, error)
UpdateFleet updates the base capacity of a fleet.
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, ) (*Webhook, error)
UpdateWebhook updates the branchFilter and buildType of an existing webhook.
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.
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"`
Name string `json:"name"`
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"`
ResourceAccessRole string `json:"resourceAccessRole,omitempty"`
Artifacts ProjectArtifacts `json:"artifacts"`
Source ProjectSource `json:"source"`
FileSystemLocations []FileSystemLocation `json:"fileSystemLocations,omitempty"`
SecondarySourceVersions []ProjectSourceVersion `json:"secondarySourceVersions,omitempty"`
SecondaryArtifacts []ProjectArtifacts `json:"secondaryArtifacts,omitempty"`
SecondarySources []ProjectSource `json:"secondarySources,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
EncryptionKey string
Name string
Description string
ServiceRole string
ResourceAccessRole string
FileSystemLocations []FileSystemLocation
SecondarySourceVersions []ProjectSourceVersion
SecondaryArtifacts []ProjectArtifacts
SecondarySources []ProjectSource
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the CodeBuild service backend and handler.
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"`
MaxCapacity int32 `json:"maxCapacity,omitempty"`
DesiredCapacity int32 `json:"desiredCapacity,omitempty"`
}
ScalingConfiguration represents the scaling settings for a compute fleet.
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 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 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 {
ProjectName string `json:"projectName"`
URL string `json:"url,omitempty"`
BranchFilter string `json:"branchFilter,omitempty"`
BuildType string `json:"buildType,omitempty"`
PayloadURL string `json:"payloadUrl,omitempty"`
FilterGroups [][]WebhookFilter `json:"filterGroups,omitempty"`
}
Webhook represents an in-memory AWS CodeBuild webhook.
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.
Source Files
¶
- build_batches.go
- builds.go
- command_executions.go
- curated_environments.go
- errors.go
- fleets.go
- handler.go
- handler_build_batches.go
- handler_builds.go
- handler_command_executions.go
- handler_curated_environments.go
- handler_fleets.go
- handler_projects.go
- handler_reports.go
- handler_resource_policies.go
- handler_sandboxes.go
- handler_source_credentials.go
- handler_tags.go
- handler_webhooks.go
- janitor.go
- models.go
- persistence.go
- projects.go
- provider.go
- reports.go
- resource_policies.go
- sandboxes.go
- settings.go
- source_credentials.go
- store.go
- store_setup.go
- tags.go
- webhooks.go