BuildEnvironment

class aws_cdk.aws_codebuild.BuildEnvironment(*, build_image=None, certificate=None, compute_type=None, environment_variables=None, privileged=None)

Bases: object

Parameters:
  • build_image (Optional[IBuildImage]) – The image used for the builds. Default: LinuxBuildImage.STANDARD_1_0

  • certificate (Union[BuildEnvironmentCertificate, Dict[str, Any], None]) – The location of the PEM-encoded certificate for the build project. Default: - No external certificate is added to the project

  • compute_type (Optional[ComputeType]) – The type of compute to use for this build. See the ComputeType enum for the possible values. Default: taken from #buildImage#defaultComputeType

  • environment_variables (Optional[Mapping[str, Union[BuildEnvironmentVariable, Dict[str, Any]]]]) – The environment variables that your builds can use.

  • privileged (Optional[bool]) – Indicates how the project builds Docker images. Specify true to enable running the Docker daemon inside a Docker container. This value must be set to true only if this build project will be used to build Docker images, and the specified build environment image is not one provided by AWS CodeBuild with Docker support. Otherwise, all associated builds that attempt to interact with the Docker daemon will fail. Default: false

ExampleMetadata:

infused

Example:

pipeline = pipelines.CodePipeline(self, "Pipeline",
    synth=pipelines.ShellStep("Synth",
        input=pipelines.CodePipelineSource.connection("my-org/my-app", "main",
            connection_arn="arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"
        ),
        commands=["npm ci", "npm run build", "npx cdk synth"]
    ),

    # Turn this on because the pipeline uses Docker image assets
    docker_enabled_for_self_mutation=True
)

pipeline.add_wave("MyWave",
    post=[
        pipelines.CodeBuildStep("RunApproval",
            commands=["command-from-image"],
            build_environment=codebuild.BuildEnvironment(
                # The user of a Docker image asset in the pipeline requires turning on
                # 'dockerEnabledForSelfMutation'.
                build_image=codebuild.LinuxBuildImage.from_asset(self, "Image",
                    directory="./docker-image"
                )
            )
        )
    ]
)

Attributes

build_image

The image used for the builds.

Default:

LinuxBuildImage.STANDARD_1_0

certificate

The location of the PEM-encoded certificate for the build project.

Default:
  • No external certificate is added to the project

compute_type

The type of compute to use for this build.

See the ComputeType enum for the possible values.

Default:

taken from #buildImage#defaultComputeType

environment_variables

The environment variables that your builds can use.

privileged

Indicates how the project builds Docker images.

Specify true to enable running the Docker daemon inside a Docker container. This value must be set to true only if this build project will be used to build Docker images, and the specified build environment image is not one provided by AWS CodeBuild with Docker support. Otherwise, all associated builds that attempt to interact with the Docker daemon will fail.

Default:

false