Skip to content
v2.273.0

CodeBuildOptions Struct ​

Options for customizing a single CodeBuild project.

Example ​

ts
declare const source: pipelines.IFileSetProducer; // the repository source
declare const synthCommands: string[]; // Commands to synthesize your app
declare const installCommands: string[]; // Commands to install your toolchain

const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
  // Standard CodePipeline properties...
  synth: new pipelines.ShellStep('Synth', {
    input: source,
    commands: synthCommands,
  }),

  // Configure CodeBuild to use a drop-in Docker replacement.
  codeBuildDefaults: {
    partialBuildSpec: codebuild.BuildSpec.fromObject({
      phases: {
        install: {
          // Add the shell commands to install your drop-in Docker
          // replacement to the CodeBuild enviromment.
          commands: installCommands,
        },
      },
    }),
    buildEnvironment: {
      environmentVariables: {
        // Instruct the AWS CDK to use `drop-in-replacement` instead of
        // `docker` when building / publishing docker images.
        // e.g., `drop-in-replacement build . -f path/to/Dockerfile`
        CDK_DOCKER: { value: 'drop-in-replacement' },
      },
    },
  },
});

Properties ​

buildEnvironmentBuildEnvironmentbuild_environmentBuildEnvironmentbuildEnvironmentBuildEnvironmentBuildEnvironmentBuildEnvironmentBuildEnvironmentBuildEnvironment= Non-privileged build, SMALL inst…#
Partial build environment, will be combined with other build environments that apply.
default

Default: Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_7_0

cacheCachecacheCachecacheCacheCacheCacheCacheCache= No cache#
Caching strategy to use.
fileSystemLocationsIFileSystemLocation[]file_system_locationstyping.List[IFileSystemLocation]fileSystemLocationsList<IFileSystemLocation>FileSystemLocationsIFileSystemLocation[]FileSystemLocations*[]IFileSystemLocation= no file system locations#
ProjectFileSystemLocation objects for CodeBuild build projects.

A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, and type of a file system created using Amazon Elastic File System. Requires a vpc to be set and privileged to be set to true.

loggingLoggingOptionsloggingLoggingOptionsloggingLoggingOptionsLoggingLoggingOptionsLoggingLoggingOptions= no log configuration is set#
Information about logs for CodeBuild projects.

A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.

partialBuildSpecBuildSpecpartial_build_specBuildSpecpartialBuildSpecBuildSpecPartialBuildSpecBuildSpecPartialBuildSpecBuildSpec= No initial BuildSpec#
Partial buildspec, will be combined with other buildspecs that apply.

The BuildSpec must be available inline--it cannot reference a file on disk.

rolePolicyPolicyStatement[]role_policytyping.List[PolicyStatement]rolePolicyList<PolicyStatement>RolePolicyPolicyStatement[]RolePolicy*[]PolicyStatement= No policy statements added to Co…#
Policy statements to add to role.
default

Default: No policy statements added to CodeBuild Project Role

securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= Security group will be automatic…#
Which security group(s) to associate with the project network interfaces.

Only used if 'vpc' is supplied.

default

Default: Security group will be automatically created.

subnetSelectionSubnetSelectionsubnet_selectionSubnetSelectionsubnetSelectionSubnetSelectionSubnetSelectionSubnetSelectionSubnetSelectionSubnetSelection= All private subnets.#
Which subnets to use.

Only used if 'vpc' is supplied.

timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= Duration.hours(1)#
The number of minutes after which AWS CodeBuild stops the build if it's not complete.

For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc= No VPC#
The VPC where to create the CodeBuild network interfaces in.