Class WindowsBuildImage
A CodeBuild image running Windows.
Inheritance
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
Remarks
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:
See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
ExampleMetadata: infused
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", "my-bucket"),
ObjectKey = "path/to/cert.pem"
}
}
});
Synopsis
Constructors
WindowsBuildImage(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
WindowsBuildImage(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
DefaultComputeType | The default |
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. |
WIN_SERVER_CORE_2019_BASE | The standard CodeBuild image |
WIN_SERVER_CORE_2019_BASE_2_0 | The standard CodeBuild image |
WIN_SERVER_CORE_2019_BASE_3_0 | The standard CodeBuild image |
WINDOWS_BASE_2_0 | (deprecated) The standard CodeBuild image |
Methods
FromAsset(Construct, String, IDockerImageAssetProps, Nullable<WindowsImageType>) | Uses an Docker image asset as a Windows build image. |
FromDockerRegistry(String, IDockerImageOptions, Nullable<WindowsImageType>) | |
FromEcrRepository(IRepository, String, Nullable<WindowsImageType>) | |
RunScriptBuildspec(String) | Make a buildspec to run the indicated script. |
Validate(IBuildEnvironment) | Allows the image a chance to validate whether the passed configuration is correct. |
Constructors
WindowsBuildImage(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected WindowsBuildImage(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
WindowsBuildImage(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected WindowsBuildImage(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
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
ImageId
The Docker image identifier that the build environment uses.
public virtual string ImageId { get; }
Property Value
System.String
ImagePullPrincipalType
The type of principal that CodeBuild will use to pull this build Docker image.
public virtual Nullable<ImagePullPrincipalType> ImagePullPrincipalType { get; }
Property Value
System.Nullable<ImagePullPrincipalType>
Repository
An optional ECR repository that the image is hosted in.
public virtual IRepository Repository { get; }
Property Value
SecretsManagerCredentials
The secretsManagerCredentials for access to a private registry.
public virtual ISecret SecretsManagerCredentials { get; }
Property Value
Type
The type of build environment.
public virtual string Type { get; }
Property Value
System.String
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
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
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
WINDOWS_BASE_2_0
(deprecated) The standard CodeBuild image aws/codebuild/windows-base:2.0
, which is based off Windows Server Core 2016.
public static IBuildImage WINDOWS_BASE_2_0 { get; }
Property Value
Remarks
Stability: Deprecated
Methods
FromAsset(Construct, String, IDockerImageAssetProps, Nullable<WindowsImageType>)
Uses an Docker image asset as a Windows build image.
public static IBuildImage FromAsset(Construct scope, string id, IDockerImageAssetProps props, Nullable<WindowsImageType> imageType = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IDockerImageAssetProps
- imageType System.Nullable<WindowsImageType>
Returns
FromDockerRegistry(String, IDockerImageOptions, Nullable<WindowsImageType>)
public static IBuildImage FromDockerRegistry(string name, IDockerImageOptions options = null, Nullable<WindowsImageType> imageType = null)
Parameters
- name System.String
- options IDockerImageOptions
- imageType System.Nullable<WindowsImageType>
Returns
a Windows build image from a Docker Hub image.
FromEcrRepository(IRepository, String, Nullable<WindowsImageType>)
public static IBuildImage FromEcrRepository(IRepository repository, string tagOrDigest = null, Nullable<WindowsImageType> imageType = null)
Parameters
- repository IRepository
The ECR repository.
- tagOrDigest System.String
Image tag or digest (default "latest", digests must start with
sha256:
).- imageType System.Nullable<WindowsImageType>
The ECR repository.
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.
Remarks
RunScriptBuildspec(String)
Make a buildspec to run the indicated script.
public virtual BuildSpec RunScriptBuildspec(string entrypoint)
Parameters
- entrypoint System.String
Returns
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
System.String[]