class WindowsBuildImage
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodeBuild.WindowsBuildImage |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#WindowsBuildImage |
![]() | software.amazon.awscdk.services.codebuild.WindowsBuildImage |
![]() | aws_cdk.aws_codebuild.WindowsBuildImage |
![]() | aws-cdk-lib » aws_codebuild » WindowsBuildImage |
Implements
IBuild
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 also: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
Example
declare const ecrRepository: ecr.Repository;
new codebuild.Project(this, 'Project', {
environment: {
buildImage: codebuild.WindowsBuildImage.fromEcrRepository(ecrRepository, 'v1.0', codebuild.WindowsImageType.SERVER_2019),
// optional certificate to include in the build image
certificate: {
bucket: s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'),
objectKey: 'path/to/cert.pem',
},
},
// ...
})
Properties
Name | Type | Description |
---|---|---|
default | Compute | The default ComputeType to use with this image, if one was not specified in BuildEnvironment#computeType explicitly. |
image | string | The Docker image identifier that the build environment uses. |
type | string | The type of build environment. |
image | Image | The type of principal that CodeBuild will use to pull this build Docker image. |
repository? | IRepository | An optional ECR repository that the image is hosted in. |
secrets | ISecret | The secretsManagerCredentials for access to a private registry. |
static WINDOWS_BASE_2_0 | IBuild | The standard CodeBuild image aws/codebuild/windows-base:2.0 , which is based off Windows Server Core 2016. |
static WIN_SERVER_CORE_2019_BASE | IBuild | The standard CodeBuild image aws/codebuild/windows-base:2019-1.0 , which is based off Windows Server Core 2019. |
static WIN_SERVER_CORE_2019_BASE_2_0 | IBuild | The standard CodeBuild image aws/codebuild/windows-base:2019-2.0 , which is based off Windows Server Core 2019. |
static WIN_SERVER_CORE_2019_BASE_3_0 | IBuild | The standard CodeBuild image aws/codebuild/windows-base:2019-3.0 , which is based off Windows Server Core 2019. |
static WIN_SERVER_CORE_2022_BASE_3_0 | IBuild | The standard CodeBuild image aws/codebuild/windows-base:2022-1.0 , which is based off Windows Server Core 2022. |
defaultComputeType
Type:
Compute
The default ComputeType
to use with this image, if one was not specified in BuildEnvironment#computeType
explicitly.
imageId
Type:
string
The Docker image identifier that the build environment uses.
type
Type:
string
The type of build environment.
imagePullPrincipalType?
Type:
Image
(optional)
The type of principal that CodeBuild will use to pull this build Docker image.
repository?
Type:
IRepository
(optional)
An optional ECR repository that the image is hosted in.
secretsManagerCredentials?
Type:
ISecret
(optional)
The secretsManagerCredentials for access to a private registry.
static WINDOWS_BASE_2_0
⚠️ Deprecated: {@link WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 } should be used instead.
Type:
IBuild
The standard CodeBuild image aws/codebuild/windows-base:2.0
, which is based off Windows Server Core 2016.
static WIN_SERVER_CORE_2019_BASE
Type:
IBuild
The standard CodeBuild image aws/codebuild/windows-base:2019-1.0
, which is based off Windows Server Core 2019.
static WIN_SERVER_CORE_2019_BASE_2_0
Type:
IBuild
The standard CodeBuild image aws/codebuild/windows-base:2019-2.0
, which is based off Windows Server Core 2019.
static WIN_SERVER_CORE_2019_BASE_3_0
Type:
IBuild
The standard CodeBuild image aws/codebuild/windows-base:2019-3.0
, which is based off Windows Server Core 2019.
static WIN_SERVER_CORE_2022_BASE_3_0
Type:
IBuild
The standard CodeBuild image aws/codebuild/windows-base:2022-1.0
, which is based off Windows Server Core 2022.
Notice: Cannot be used with on-demand compute, only with a {@link BuildEnvironment.fleet}.
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/fleets.html
Methods
Name | Description |
---|---|
run | Make a buildspec to run the indicated script. |
validate(buildEnvironment) | Allows the image a chance to validate whether the passed configuration is correct. |
static from | Uses an Docker image asset as a Windows build image. |
static from | |
static from |
runScriptBuildspec(entrypoint)
public runScriptBuildspec(entrypoint: string): BuildSpec
Parameters
- entrypoint
string
Returns
Make a buildspec to run the indicated script.
validate(buildEnvironment)
public validate(buildEnvironment: BuildEnvironment): string[]
Parameters
- buildEnvironment
Build
Environment
Returns
string[]
Allows the image a chance to validate whether the passed configuration is correct.
static fromAsset(scope, id, props, imageType?)
public static fromAsset(scope: Construct, id: string, props: DockerImageAssetProps, imageType?: WindowsImageType): IBuildImage
Parameters
- scope
Construct
- id
string
- props
Docker
Image Asset Props - imageType
Windows
Image Type
Returns
Uses an Docker image asset as a Windows build image.
static fromDockerRegistry(name, options?, imageType?)
public static fromDockerRegistry(name: string, options?: DockerImageOptions, imageType?: WindowsImageType): IBuildImage
Parameters
- name
string
- options
Docker
Image Options - imageType
Windows
Image Type
Returns
static fromEcrRepository(repository, tagOrDigest?, imageType?)
public static fromEcrRepository(repository: IRepository, tagOrDigest?: string, imageType?: WindowsImageType): IBuildImage
Parameters
- repository
IRepository
— The ECR repository. - tagOrDigest
string
— Image tag or digest (default "latest", digests must start withsha256:
). - imageType
Windows
Image Type
Returns
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html