aws-cdk-lib.pipelines.CodeBuildOptions

interface CodeBuildOptions

LanguageType name
.NETAmazon.CDK.Pipelines.CodeBuildOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/pipelines#CodeBuildOptions
Javasoftware.amazon.awscdk.pipelines.CodeBuildOptions
Pythonaws_cdk.pipelines.CodeBuildOptions
TypeScript (source)aws-cdk-lib » pipelines » CodeBuildOptions

Options for customizing a single CodeBuild project.

Example

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

NameTypeDescription
buildEnvironment?BuildEnvironmentPartial build environment, will be combined with other build environments that apply.
cache?CacheCaching strategy to use.
fileSystemLocations?IFileSystemLocation[]ProjectFileSystemLocation objects for CodeBuild build projects.
logging?LoggingOptionsInformation about logs for CodeBuild projects.
partialBuildSpec?BuildSpecPartial buildspec, will be combined with other buildspecs that apply.
rolePolicy?PolicyStatement[]Policy statements to add to role.
securityGroups?ISecurityGroup[]Which security group(s) to associate with the project network interfaces.
subnetSelection?SubnetSelectionWhich subnets to use.
timeout?DurationThe number of minutes after which AWS CodeBuild stops the build if it's not complete.
vpc?IVpcThe VPC where to create the CodeBuild network interfaces in.

buildEnvironment?

Type: BuildEnvironment (optional, default: Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_6_0)

Partial build environment, will be combined with other build environments that apply.


cache?

Type: Cache (optional, default: No cache)

Caching strategy to use.


fileSystemLocations?

Type: IFileSystemLocation[] (optional, default: 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.


logging?

Type: LoggingOptions (optional, default: 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.


partialBuildSpec?

Type: BuildSpec (optional, default: 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.


rolePolicy?

Type: PolicyStatement[] (optional, default: No policy statements added to CodeBuild Project Role)

Policy statements to add to role.


securityGroups?

Type: ISecurityGroup[] (optional, default: Security group will be automatically created.)

Which security group(s) to associate with the project network interfaces.

Only used if 'vpc' is supplied.


subnetSelection?

Type: SubnetSelection (optional, default: All private subnets.)

Which subnets to use.

Only used if 'vpc' is supplied.


timeout?

Type: Duration (optional, default: 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?

Type: IVpc (optional, default: No VPC)

The VPC where to create the CodeBuild network interfaces in.