# CodeBuildOptions

Options for customizing a single CodeBuild project.

- Source: [`pipelines/lib/codepipeline/codepipeline.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts#L308)
- Type last changed: v2.93.0 · 23 Aug 2023

## 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

- `buildEnvironment`: [BuildEnvironment](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.BuildEnvironment.html) — Partial build environment, will be combined with other build environments that apply.

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

- `cache`: [Cache](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.Cache.html) — Caching strategy to use.

  **Default:** No cache

- `fileSystemLocations`: [IFileSystemLocation](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.IFileSystemLocation.html)[] — ProjectFileSystemLocation objects for CodeBuild build projects.

  **Default:** no file system locations

  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.

- `logging`: [LoggingOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.LoggingOptions.html) — Information about logs for CodeBuild projects.

  **Default:** no log configuration is set

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

- `partialBuildSpec`: [BuildSpec](/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild.BuildSpec.html) — Partial buildspec, will be combined with other buildspecs that apply.

  **Default:** No initial BuildSpec

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

- `rolePolicy`: [PolicyStatement](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html)[] — Policy statements to add to role.

  **Default:** No policy statements added to CodeBuild Project Role

- `securityGroups`: [ISecurityGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — Which security group(s) to associate with the project network interfaces.

  **Default:** Security group will be automatically created.

  Only used if 'vpc' is supplied.

- `subnetSelection`: [SubnetSelection](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Which subnets to use.

  **Default:** All private subnets.

  Only used if 'vpc' is supplied.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 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.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — The VPC where to create the CodeBuild network interfaces in.

  **Default:** No VPC
