AWS CodeBuild
AWS CodeBuild (codebuild) on fakecloud: a complete 59-operation implementation (100% conformance) — build projects, builds and build batches, report groups and reports, fleets, webhooks, source credentials, resource policies, and sandboxes. awsJson1.1.
fakecloud implements AWS CodeBuild as an awsJson1.1 service (sigv4 signing name codebuild, target prefix CodeBuild_20161006). All 59 operations ship with 100% conformance against AWS's own Smithy model, backed by account-partitioned state that persists across restarts in persistent mode.
CodeBuild is the managed build service, and fakecloud runs the build for real. StartBuild returns immediately with the build IN_PROGRESS; a background task then resolves the environment image, parses the buildspec, and executes each phase's commands in a real Docker/Podman container, settling buildStatus on the actual container exit codes. Build output streams to CloudWatch Logs and declared S3 artifacts are uploaded — see Real build execution. The whole control plane is real, persisted CRUD on top of that. When no container runtime is available (or the backend is disabled via FAKECLOUD_CODEBUILD_DISABLE_BACKEND), a build settles deterministically to SUCCEEDED on read instead, so API shapes are unchanged.
Build projects
CreateProject / UpdateProject / DeleteProject / BatchGetProjects / ListProjects manage build projects. The source, artifacts, environment, cache, logsConfig, vpcConfig, and fileSystemLocations blocks round-trip verbatim; the create-time badgeEnabled flag is rendered as the output badge structure, and each project mints an ARN in exact AWS form (arn:aws:codebuild:<region>:<acct>:project/<name>). UpdateProjectVisibility toggles PUBLIC_READ / PRIVATE (and returns a publicProjectAlias), InvalidateProjectCache clears the cache, and ListSharedProjects reports the account's shareable project ARNs. Model-derived @length (project name 2-150), enum (SourceType / ArtifactsType / EnvironmentType / ComputeType), and sort validation is enforced.
Builds and build batches
StartBuild resolves the project (applying the *Override inputs), mints a build id (<project>:<uuid>) and ARN, and returns a build in IN_PROGRESS without blocking the handler on the image pull or container run. BatchGetBuilds returns the real per-phase breakdown as the build progresses and its terminal buildStatus (SUCCEEDED / FAILED / STOPPED / TIMED_OUT) once it settles. StopBuild kills the running container and settles STOPPED; RetryBuild re-runs the resolved buildspec. BatchDeleteBuilds, ListBuilds, and ListBuildsForProject complete the build surface. The batch variants (StartBuildBatch / StopBuildBatch / RetryBuildBatch / DeleteBuildBatch / BatchGetBuildBatches / ListBuildBatches / ListBuildBatchesForProject) mirror the single-build execution path for BuildBatch records.
Real build execution
When a container runtime is available, the background build task:
- Resolves the image from
environment.image. A user-supplied image is used verbatim; an AWS-curatedaws/codebuild/*image (not publicly pullable) maps to a small runnable Ubuntu so the buildspeccommandsexecute unchanged. An image already in the local cache is used as is; a missing one is pulled first, retrying a transient registry failure (rate limiting such as429 Too Many Requests, a 5xx, a network timeout) with backoff. - Parses the buildspec — the inline
source.buildspecor aStartBuild.buildspecOverride— readingenv.variablesand theinstall/pre_build/build/post_buildphasecommandsand theartifactsblock. - Runs the phases in the container, carrying state across them (cwd + exported variables are threaded phase-to-phase), so
cdandexportin one phase persist into the next exactly like AWS — while a failing command (including aexit N) fails only that phase (recorded FAILED) rather than silently aborting the build. The standard CodeBuild environment variables are set (CODEBUILD_BUILD_ID,CODEBUILD_BUILD_ARN,CODEBUILD_SOURCE_VERSION,CODEBUILD_BUILD_NUMBER, plus the project'senvironmentVariablesand the buildspecenv.variables).PARAMETER_STOREandSECRETS_MANAGERenvironment variables are resolved cross-service from SSM / Secrets Manager and injected into the container; as on AWS, one that names nothing or cannot be decrypted (its KMS key disabled or refusing) fails the build inDOWNLOAD_SOURCEafter provisioning (Secrets Manager ErrorwithGetSecretValue's<code>: <message>, orDecrypted Variables Error"parameter does not exist:") instead of running with the variable empty. A failing command fails its phase; a failed install/pre_build/buildskips ahead butpost_buildstill runs — matching AWS's phase-failure semantics. Eachphases[]entry carries the realphaseStatus,startTime,endTime,durationInSeconds, andcontexts. A build that exceeds itstimeoutInMinutes(default 60, up to 480) is killed and settlesTIMED_OUT.- Streams logs to CloudWatch Logs into the project's
logsConfiggroup and stream (or the default/aws/codebuild/<project>group), soBuild.logspoints at a real, readable log group/stream.- Uploads S3 artifacts — when
artifacts.type == S3, the declaredartifacts.filesglob patterns (**/*,target/*.jar,base-directory,discard-paths) are matched against the build output and written to the S3 location (NONEorZIPpackaging). A pattern that matches nothing fails the build, matching AWS.NO_ARTIFACTSskips this phase.StartBuildBatchmirrors this single-build execution for real (running the resolved buildspec in a container and settlingbuildBatchStatuson the exit code), and reports the BuildBatch-shaped phases (DOWNLOAD_BATCHSPEC,IN_PROGRESS,COMBINE_ARTIFACTS) withlogConfig. fakecloud does not fan a batch out into a build matrix/graph of child builds.buildStatussettles on the real container exit codes. A build that is stillIN_PROGRESSwhen the server restarts (its container is gone) is reconciled toFAILEDon the next start rather than left a zombie. SetFAKECLOUD_CODEBUILD_DISABLE_BACKEND=1to force the deterministic settle-to-SUCCEEDED-on-read path instead of running containers.Report groups, reports, and test data
CreateReportGroup/UpdateReportGroup/DeleteReportGroup/BatchGetReportGroups/ListReportGroups/ListSharedReportGroupsmanage report groups (TESTorCODE_COVERAGE), andGetReportGroupTrendreturns trend stats.BatchGetReports/ListReports/ListReportsForReportGroup/DeleteReportcover reports, andDescribeTestCases/DescribeCodeCoveragesreturn the paginated test-case and coverage surfaces.Fleets, webhooks, and credentials
CreateFleet/UpdateFleet/DeleteFleet/BatchGetFleets/ListFleetsmanage reserved-capacity fleets.CreateWebhook/UpdateWebhook/DeleteWebhookattach a webhook to a project (minting a payload URL and secret).ImportSourceCredentials/DeleteSourceCredentials/ListSourceCredentialsstore per-server-type credentials — the token ARN renders the server type lowercase (token/github) exactly as AWS does.PutResourcePolicy/GetResourcePolicy/DeleteResourcePolicyattach a resource policy to an existing project or report group, andListCuratedEnvironmentImagesreturns the curated managed-image catalogue.Sandboxes
StartSandbox/StopSandbox/StartSandboxConnection/BatchGetSandboxes/ListSandboxes/ListSandboxesForProjectand the command-execution surface (StartCommandExecution/BatchGetCommandExecutions/ListCommandExecutionsForSandbox) model CodeBuild's interactive sandbox primitive as real, persisted CRUD.Not implemented
There is no build container engine — the actual build execution (running buildspec phases in a container) is out of scope, matching how LocalStack Community mocks CodeBuild. Builds settle to a terminal status synchronously, and test-case / code-coverage reads return well-formed empty result sets for synthetically created reports.
- Streams logs to CloudWatch Logs into the project's