CodeBuildOptions

class aws_cdk.pipelines.CodeBuildOptions(*, build_environment=None, cache=None, file_system_locations=None, logging=None, partial_build_spec=None, role_policy=None, security_groups=None, subnet_selection=None, timeout=None, vpc=None)

Bases: object

Options for customizing a single CodeBuild project.

Parameters:
  • build_environment (Union[BuildEnvironment, Dict[str, Any], None]) – Partial build environment, will be combined with other build environments that apply. Default: - Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_7_0

  • cache (Optional[Cache]) – Caching strategy to use. Default: - No cache

  • file_system_locations (Optional[Sequence[IFileSystemLocation]]) – 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. Default: - no file system locations

  • logging (Union[LoggingOptions, Dict[str, Any], None]) – Information about logs for CodeBuild projects. A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both. Default: - no log configuration is set

  • partial_build_spec (Optional[BuildSpec]) – Partial buildspec, will be combined with other buildspecs that apply. The BuildSpec must be available inline–it cannot reference a file on disk. Default: - No initial BuildSpec

  • role_policy (Optional[Sequence[PolicyStatement]]) – Policy statements to add to role. Default: - No policy statements added to CodeBuild Project Role

  • security_groups (Optional[Sequence[ISecurityGroup]]) – Which security group(s) to associate with the project network interfaces. Only used if ‘vpc’ is supplied. Default: - Security group will be automatically created.

  • subnet_selection (Union[SubnetSelection, Dict[str, Any], None]) – Which subnets to use. Only used if ‘vpc’ is supplied. Default: - All private subnets.

  • timeout (Optional[Duration]) – 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. Default: Duration.hours(1)

  • vpc (Optional[IVpc]) – The VPC where to create the CodeBuild network interfaces in. Default: - No VPC

ExampleMetadata:

infused

Example:

# source: pipelines.IFileSetProducer # the repository source
# synth_commands: List[str] # Commands to synthesize your app
# install_commands: List[str]
# Commands to install your toolchain

pipeline = pipelines.CodePipeline(self, "Pipeline",
    # Standard CodePipeline properties...
    synth=pipelines.ShellStep("Synth",
        input=source,
        commands=synth_commands
    ),

    # Configure CodeBuild to use a drop-in Docker replacement.
    code_build_defaults=pipelines.CodeBuildOptions(
        partial_build_spec=codebuild.BuildSpec.from_object({
            "phases": {
                "install": {
                    # Add the shell commands to install your drop-in Docker
                    # replacement to the CodeBuild enviromment.
                    "commands": install_commands
                }
            }
        }),
        build_environment=codebuild.BuildEnvironment(
            environment_variables={
                # 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": codebuild.BuildEnvironmentVariable(value="drop-in-replacement")
            }
        )
    )
)

Attributes

build_environment

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

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

cache

Caching strategy to use.

Default:
  • No cache

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.

Default:
  • no file system locations

logging

Information about logs for CodeBuild projects.

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

Default:
  • no log configuration is set

partial_build_spec

Partial buildspec, will be combined with other buildspecs that apply.

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

Default:
  • No initial BuildSpec

role_policy

Policy statements to add to role.

Default:
  • No policy statements added to CodeBuild Project Role

security_groups

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

Only used if ‘vpc’ is supplied.

Default:
  • Security group will be automatically created.

subnet_selection

Which subnets to use.

Only used if ‘vpc’ is supplied.

Default:
  • All private subnets.

timeout

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.

Default:

Duration.hours(1)

vpc

The VPC where to create the CodeBuild network interfaces in.

Default:
  • No VPC