Skip to content

CodeBuild

CloudMock emulates AWS CodeBuild, supporting project management, build execution lifecycle, and report groups.

OperationStatusNotes
CreateProjectSupportedCreates a build project
BatchGetProjectsSupportedReturns details for multiple projects
ListProjectsSupportedLists all project names
UpdateProjectSupportedUpdates project configuration
DeleteProjectSupportedDeletes a project
StartBuildSupportedStarts a build with simulated phases
BatchGetBuildsSupportedReturns details for multiple builds
ListBuildsForProjectSupportedLists builds for a project
StopBuildSupportedStops a running build
CreateReportGroupSupportedCreates a report group
BatchGetReportGroupsSupportedReturns details for report groups
ListReportGroupsSupportedLists all report groups
DeleteReportGroupSupportedDeletes a report group
import { CodeBuildClient, CreateProjectCommand, StartBuildCommand } from '@aws-sdk/client-codebuild';
const client = new CodeBuildClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
await client.send(new CreateProjectCommand({
name: 'my-project',
source: { type: 'GITHUB', location: 'https://github.com/example/repo' },
artifacts: { type: 'NO_ARTIFACTS' },
environment: { type: 'LINUX_CONTAINER', computeType: 'BUILD_GENERAL1_SMALL', image: 'aws/codebuild/standard:7.0' },
serviceRole: 'arn:aws:iam::000000000000:role/codebuild-role',
}));
const { build } = await client.send(new StartBuildCommand({ projectName: 'my-project' }));
console.log(build.id);
import boto3
client = boto3.client('codebuild',
endpoint_url='http://localhost:4566',
region_name='us-east-1',
aws_access_key_id='test',
aws_secret_access_key='test')
client.create_project(
name='my-project',
source={'type': 'GITHUB', 'location': 'https://github.com/example/repo'},
artifacts={'type': 'NO_ARTIFACTS'},
environment={'type': 'LINUX_CONTAINER', 'computeType': 'BUILD_GENERAL1_SMALL', 'image': 'aws/codebuild/standard:7.0'},
serviceRole='arn:aws:iam::000000000000:role/codebuild-role')
response = client.start_build(projectName='my-project')
print(response['build']['id'])
cloudmock.yml
services:
codebuild:
enabled: true
  • Builds are not actually executed; phases are simulated
  • Build logs are not generated
  • Source code is not pulled from repositories