Class WindowsBuildImage

A CodeBuild image running Windows.

Inheritance

WindowsBuildImage

Implements
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class WindowsBuildImage : DeputyBase, IBuildImage
Syntax (vb)
Public Class WindowsBuildImage Inherits DeputyBase Implements IBuildImage
Examples
Repository ecrRepository;


             new Project(this, "Project", new ProjectProps {
                 Environment = new BuildEnvironment {
                     BuildImage = WindowsBuildImage.FromEcrRepository(ecrRepository, "v1.0", WindowsImageType.SERVER_2019),
                     // optional certificate to include in the build image
                     Certificate = new BuildEnvironmentCertificate {
                         Bucket = Bucket.FromBucketName(this, "Bucket", "amzn-s3-demo-bucket"),
                         ObjectKey = "path/to/cert.pem"
                     }
                 }
             });

Synopsis

Properties

DefaultComputeType

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

ImageId

The Docker image identifier that the build environment uses.

ImagePullPrincipalType

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.

SecretsManagerCredentials

The secretsManagerCredentials for access to a private registry.

Type

The type of build environment.

WINDOWS_BASE_2_0

(deprecated) The standard CodeBuild image aws/codebuild/windows-base:2.0, which is based off Windows Server Core 2016.

WIN_SERVER_CORE_2019_BASE

The standard CodeBuild image aws/codebuild/windows-base:2019-1.0, which is based off Windows Server Core 2019.

WIN_SERVER_CORE_2019_BASE_2_0

The standard CodeBuild image aws/codebuild/windows-base:2019-2.0, which is based off Windows Server Core 2019.

WIN_SERVER_CORE_2019_BASE_3_0

The standard CodeBuild image aws/codebuild/windows-base:2019-3.0, which is based off Windows Server Core 2019.

WIN_SERVER_CORE_2022_BASE_3_0

The standard CodeBuild image aws/codebuild/windows-base:2022-1.0, which is based off Windows Server Core 2022.

Methods

Properties

DefaultComputeType

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

public virtual ComputeType DefaultComputeType { get; }
Property Value

ComputeType

ImageId

The Docker image identifier that the build environment uses.

public virtual string ImageId { get; }
Property Value

string

ImagePullPrincipalType

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

public virtual ImagePullPrincipalType? ImagePullPrincipalType { get; }
Property Value

ImagePullPrincipalType?

Repository

An optional ECR repository that the image is hosted in.

public virtual IRepository? Repository { get; }
Property Value

IRepository

SecretsManagerCredentials

The secretsManagerCredentials for access to a private registry.

public virtual ISecret? SecretsManagerCredentials { get; }
Property Value

ISecret

Type

The type of build environment.

public virtual string Type { get; }
Property Value

string

WINDOWS_BASE_2_0

(deprecated) The standard CodeBuild image aws/codebuild/windows-base:2.0, which is based off Windows Server Core 2016.

[Obsolete("{@link WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 } should be used instead.")]
public static IBuildImage WINDOWS_BASE_2_0 { get; }
Property Value

IBuildImage

WIN_SERVER_CORE_2019_BASE

The standard CodeBuild image aws/codebuild/windows-base:2019-1.0, which is based off Windows Server Core 2019.

public static IBuildImage WIN_SERVER_CORE_2019_BASE { get; }
Property Value

IBuildImage

WIN_SERVER_CORE_2019_BASE_2_0

The standard CodeBuild image aws/codebuild/windows-base:2019-2.0, which is based off Windows Server Core 2019.

public static IBuildImage WIN_SERVER_CORE_2019_BASE_2_0 { get; }
Property Value

IBuildImage

WIN_SERVER_CORE_2019_BASE_3_0

The standard CodeBuild image aws/codebuild/windows-base:2019-3.0, which is based off Windows Server Core 2019.

public static IBuildImage WIN_SERVER_CORE_2019_BASE_3_0 { get; }
Property Value

IBuildImage

WIN_SERVER_CORE_2022_BASE_3_0

The standard CodeBuild image aws/codebuild/windows-base:2022-1.0, which is based off Windows Server Core 2022.

public static IBuildImage WIN_SERVER_CORE_2022_BASE_3_0 { get; }
Property Value

IBuildImage

Methods

FromAsset(Construct, string, IDockerImageAssetProps, WindowsImageType?)

Uses an Docker image asset as a Windows build image.

public static IBuildImage FromAsset(Construct scope, string id, IDockerImageAssetProps props, WindowsImageType? imageType = null)
Parameters
scope Construct
id string
props IDockerImageAssetProps
imageType WindowsImageType?
Returns

IBuildImage

FromDockerRegistry(string, IDockerImageOptions?, WindowsImageType?)

A CodeBuild image running Windows.

public static IBuildImage FromDockerRegistry(string name, IDockerImageOptions? options = null, WindowsImageType? imageType = null)
Parameters
name string
options IDockerImageOptions
imageType WindowsImageType?
Returns

IBuildImage

a Windows build image from a Docker Hub image.

FromEcrRepository(IRepository, string?, WindowsImageType?)

A CodeBuild image running Windows.

public static IBuildImage FromEcrRepository(IRepository repository, string? tagOrDigest = null, WindowsImageType? imageType = null)
Parameters
repository IRepository

The ECR repository.

tagOrDigest string

Image tag or digest (default "latest", digests must start with sha256:).

imageType WindowsImageType?

The ECR repository.

Returns

IBuildImage

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.

RunScriptBuildspec(string)

Make a buildspec to run the indicated script.

public virtual BuildSpec RunScriptBuildspec(string entrypoint)
Parameters
entrypoint string
Returns

BuildSpec

Validate(IBuildEnvironment)

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

public virtual string[] Validate(IBuildEnvironment buildEnvironment)
Parameters
buildEnvironment IBuildEnvironment
Returns

string[]

Implements