WindowsBuildImage Class
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])
Example
ts
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
defaultComputeTypeComputeTypedefault_compute_typeComputeTypedefaultComputeTypeComputeTypeDefaultComputeTypeComputeTypeDefaultComputeTypeComputeTyperequired#The default `ComputeType` to use with this image, if one was not specified in `BuildEnvironment#computeType` explicitly.
The Docker image identifier that the build environment uses.
imagePullPrincipalTypeImagePullPrincipalTypeimage_pull_principal_typeImagePullPrincipalTypeimagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalTypeImagePullPrincipalType#The type of principal that CodeBuild will use to pull this build Docker image.
repositoryIRepositoryrepositoryIRepositoryrepositoryIRepositoryRepositoryIRepositoryRepositoryIRepository#An optional ECR repository that the image is hosted in.
secretsManagerCredentialsISecretsecrets_manager_credentialsISecretsecretsManagerCredentialsISecretSecretsManagerCredentialsISecretSecretsManagerCredentialsISecret#The secretsManagerCredentials for access to a private registry.
The type of build environment.
WIN_SERVER_CORE_2019_BASEIBuildImagewin_server_core_2019_baseIBuildImageWIN_SERVER_CORE_2019_BASEIBuildImageWIN_SERVER_CORE_2019_BASEIBuildImageWIN_SERVER_CORE_2019_BASEIBuildImagerequiredstatic#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_0IBuildImagewin_server_core_2019_base_2_0IBuildImageWIN_SERVER_CORE_2019_BASE_2_0IBuildImageWIN_SERVER_CORE_2019_BASE_2_0IBuildImageWIN_SERVER_CORE_2019_BASE_2_0IBuildImagerequiredstatic#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_0IBuildImagewin_server_core_2019_base_3_0IBuildImageWIN_SERVER_CORE_2019_BASE_3_0IBuildImageWIN_SERVER_CORE_2019_BASE_3_0IBuildImageWIN_SERVER_CORE_2019_BASE_3_0IBuildImagerequiredstatic#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_0IBuildImagewin_server_core_2022_base_3_0IBuildImageWIN_SERVER_CORE_2022_BASE_3_0IBuildImageWIN_SERVER_CORE_2022_BASE_3_0IBuildImageWIN_SERVER_CORE_2022_BASE_3_0IBuildImagerequiredstatic#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}.
WINDOWS_BASE_2_0IBuildImagewindows_base_2_0IBuildImageWINDOWS_BASE_2_0IBuildImageWINDOWS_BASE_2_0IBuildImageWINDOWS_BASE_2_0IBuildImagerequiredstaticdeprecated#{@link WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 } should be used instead.
Methods
fromAsset(scope: Construct, id: string, props: DockerImageAssetProps, imageType?: WindowsImageType): IBuildImage@staticmethod def from_asset(scope: Construct, id: str, props: DockerImageAssetProps, image_type: typing.Optional[WindowsImageType] = None) -> IBuildImagepublic static IBuildImage fromAsset(Construct scope, String id, DockerImageAssetProps props, WindowsImageType imageType)public static IBuildImage FromAsset(Construct scope, string id, DockerImageAssetProps props, WindowsImageType? imageType = null)func FromAsset(Scope Construct, Id *string, Props DockerImageAssetProps, ImageType WindowsImageType) IBuildImagestatic#Uses an Docker image asset as a Windows build image.
fromDockerRegistry(name: string, options?: DockerImageOptions, imageType?: WindowsImageType): IBuildImage@staticmethod def from_docker_registry(name: str, options: typing.Optional[DockerImageOptions] = None, image_type: typing.Optional[WindowsImageType] = None) -> IBuildImagepublic static IBuildImage fromDockerRegistry(String name, DockerImageOptions options, WindowsImageType imageType)public static IBuildImage FromDockerRegistry(string name, DockerImageOptions? options = null, WindowsImageType? imageType = null)func FromDockerRegistry(Name *string, Options DockerImageOptions, ImageType WindowsImageType) IBuildImagestatic#returns
Returns: a Windows build image from a Docker Hub image.
fromEcrRepository(repository: IRepository, tagOrDigest?: string, imageType?: WindowsImageType): IBuildImage@staticmethod def from_ecr_repository(repository: IRepository, tag_or_digest: typing.Optional[str] = None, image_type: typing.Optional[WindowsImageType] = None) -> IBuildImagepublic static IBuildImage fromEcrRepository(IRepository repository, String tagOrDigest, WindowsImageType imageType)public static IBuildImage FromEcrRepository(IRepository repository, string? tagOrDigest = null, WindowsImageType? imageType = null)func FromEcrRepository(Repository IRepository, TagOrDigest *string, ImageType WindowsImageType) IBuildImagestatic#2 parameters · returns
Parameters
repositoryrepositoryrepositoryrepositoryRepository— The ECR repository.tagOrDigesttag_or_digesttagOrDigesttagOrDigestTagOrDigest— Image tag or digest (default "latest", digests must start withsha256:).
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.
runScriptBuildspec(entrypoint: string): BuildSpecdef run_script_buildspec(self, entrypoint: str) -> BuildSpecpublic BuildSpec runScriptBuildspec(String entrypoint)public BuildSpec RunScriptBuildspec(string entrypoint)func RunScriptBuildspec(Entrypoint *string) BuildSpec#Make a buildspec to run the indicated script.
validate(buildEnvironment: BuildEnvironment): string[]def validate(self, build_environment: BuildEnvironment) -> typing.List[str]public List<String> validate(BuildEnvironment buildEnvironment)public string[] Validate(BuildEnvironment buildEnvironment)func Validate(BuildEnvironment BuildEnvironment) *[]*string#Allows the image a chance to validate whether the passed configuration is correct.