WindowsBuildImage

class aws_cdk.aws_codebuild.WindowsBuildImage(*args: Any, **kwargs)

Bases: object

A CodeBuild image running Windows.

This class has a bunch of public constants that represent the most popular images.

You can also specify a custom image using one of the static methods:

  • WindowsBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }, imageType])

  • WindowsBuildImage.fromEcrRepository(repo[, tag, imageType])

  • WindowsBuildImage.fromAsset(parent, id, props, [, imageType])

See:

https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html

ExampleMetadata:

infused

Example:

# ecr_repository: ecr.Repository


codebuild.Project(self, "Project",
    environment=codebuild.BuildEnvironment(
        build_image=codebuild.WindowsBuildImage.from_ecr_repository(ecr_repository, "v1.0", codebuild.WindowsImageType.SERVER_2019),
        # optional certificate to include in the build image
        certificate=codebuild.BuildEnvironmentCertificate(
            bucket=s3.Bucket.from_bucket_name(self, "Bucket", "my-bucket"),
            object_key="path/to/cert.pem"
        )
    )
)

Methods

run_script_buildspec(entrypoint)

Make a buildspec to run the indicated script.

Parameters:

entrypoint (str) –

Return type:

BuildSpec

validate(*, build_image=None, certificate=None, compute_type=None, environment_variables=None, privileged=None)

Allows the image a chance to validate whether the passed configuration is correct.

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 {@link ComputeType} enum for the possible values. Default: taken from {@link #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

Return type:

List[str]

Attributes

WINDOWS_BASE_2_0 = <aws_cdk.aws_codebuild.WindowsBuildImage object>
WIN_SERVER_CORE_2016_BASE = <aws_cdk.aws_codebuild.WindowsBuildImage object>
WIN_SERVER_CORE_2019_BASE = <aws_cdk.aws_codebuild.WindowsBuildImage object>
default_compute_type

The default {@link ComputeType} to use with this image, if one was not specified in {@link BuildEnvironment#computeType} explicitly.

image_id

The Docker image identifier that the build environment uses.

image_pull_principal_type

The type of principal that CodeBuild will use to pull this build Docker image.

repository

An optional ECR repository that the image is hosted in.

secrets_manager_credentials

The secretsManagerCredentials for access to a private registry.

type

The type of build environment.

Static Methods

classmethod from_asset(scope, id, props, image_type=None)

Uses an Docker image asset as a Windows build image.

Parameters:
Return type:

IBuildImage

classmethod from_docker_registry(name, options=None, image_type=None)
Parameters:
Return type:

IBuildImage

Returns:

a Windows build image from a Docker Hub image.

classmethod from_ecr_repository(repository, tag_or_digest=None, image_type=None)
Parameters:
  • repository (IRepository) – The ECR repository.

  • tag_or_digest (Optional[str]) – Image tag or digest (default “latest”, digests must start with sha256:).

  • image_type (Optional[WindowsImageType]) –

Return type:

IBuildImage

Returns:

A Windows build image from an ECR repository.

NOTE: if the repository is external (i.e. imported), then we won’t be able to add a resource policy statement for it so CodeBuild can pull the image.

See:

https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html