BuildEnvironment

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

Bases: object

Parameters:
  • build_image (Optional[IBuildImage]) – The image used for the builds. Default: LinuxBuildImage.STANDARD_7_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.

  • fleet (Optional[IFleet]) – Fleet resource for a reserved capacity CodeBuild project. Fleets allow for process builds or tests to run immediately and reduces build durations, by reserving compute resources for your projects. You will be charged for the resources in the fleet, even if they are idle. Default: - No fleet will be attached to the project, which will remain on-demand.

  • 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_7_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.

fleet

Fleet resource for a reserved capacity CodeBuild project.

Fleets allow for process builds or tests to run immediately and reduces build durations, by reserving compute resources for your projects.

You will be charged for the resources in the fleet, even if they are idle.

Default:
  • No fleet will be attached to the project, which will remain on-demand.

See:

https://docs.aws.amazon.com/codebuild/latest/userguide/fleets.html

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