Class WindowsBuildImage

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.codebuild.WindowsBuildImage
All Implemented Interfaces:
IBuildImage, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:14.123Z") @Stability(Stable) public class WindowsBuildImage extends software.amazon.jsii.JsiiObject implements IBuildImage
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:

 Repository ecrRepository;
 Project.Builder.create(this, "Project")
         .environment(BuildEnvironment.builder()
                 .buildImage(WindowsBuildImage.fromEcrRepository(ecrRepository, "v1.0", WindowsImageType.SERVER_2019))
                 // optional certificate to include in the build image
                 .certificate(BuildEnvironmentCertificate.builder()
                         .bucket(Bucket.fromBucketName(this, "Bucket", "my-bucket"))
                         .objectKey("path/to/cert.pem")
                         .build())
                 .build())
         .build();
 

See Also:
  • Field Details

    • WIN_SERVER_CORE_2019_BASE

      @Stability(Stable) public static final 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.
    • WIN_SERVER_CORE_2019_BASE_2_0

      @Stability(Stable) public static final 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.
    • WIN_SERVER_CORE_2019_BASE_3_0

      @Stability(Stable) public static final 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.
    • WINDOWS_BASE_2_0

      @Stability(Deprecated) @Deprecated public static final IBuildImage WINDOWS_BASE_2_0
      Deprecated.
      WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 should be used instead.
      (deprecated) The standard CodeBuild image aws/codebuild/windows-base:2.0, which is based off Windows Server Core 2016.

  • Constructor Details

    • WindowsBuildImage

      protected WindowsBuildImage(software.amazon.jsii.JsiiObjectRef objRef)
    • WindowsBuildImage

      protected WindowsBuildImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • fromAsset

      @Stability(Stable) @NotNull public static IBuildImage fromAsset(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DockerImageAssetProps props, @Nullable WindowsImageType imageType)
      Uses an Docker image asset as a Windows build image.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
      imageType -
    • fromAsset

      @Stability(Stable) @NotNull public static IBuildImage fromAsset(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull DockerImageAssetProps props)
      Uses an Docker image asset as a Windows build image.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
    • fromDockerRegistry

      @Stability(Stable) @NotNull public static IBuildImage fromDockerRegistry(@NotNull String name, @Nullable DockerImageOptions options, @Nullable WindowsImageType imageType)
      Parameters:
      name - This parameter is required.
      options -
      imageType -
      Returns:
      a Windows build image from a Docker Hub image.
    • fromDockerRegistry

      @Stability(Stable) @NotNull public static IBuildImage fromDockerRegistry(@NotNull String name, @Nullable DockerImageOptions options)
      Parameters:
      name - This parameter is required.
      options -
      Returns:
      a Windows build image from a Docker Hub image.
    • fromDockerRegistry

      @Stability(Stable) @NotNull public static IBuildImage fromDockerRegistry(@NotNull String name)
      Parameters:
      name - This parameter is required.
      Returns:
      a Windows build image from a Docker Hub image.
    • fromEcrRepository

      @Stability(Stable) @NotNull public static IBuildImage fromEcrRepository(@NotNull IRepository repository, @Nullable String tagOrDigest, @Nullable WindowsImageType imageType)
      Parameters:
      repository - The ECR repository. This parameter is required.
      tagOrDigest - Image tag or digest (default "latest", digests must start with sha256:).
      imageType -
      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 Also:
    • fromEcrRepository

      @Stability(Stable) @NotNull public static IBuildImage fromEcrRepository(@NotNull IRepository repository, @Nullable String tagOrDigest)
      Parameters:
      repository - The ECR repository. This parameter is required.
      tagOrDigest - Image tag or digest (default "latest", digests must start with sha256:).
      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 Also:
    • fromEcrRepository

      @Stability(Stable) @NotNull public static IBuildImage fromEcrRepository(@NotNull IRepository repository)
      Parameters:
      repository - The ECR repository. This parameter is required.
      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 Also:
    • runScriptBuildspec

      @Stability(Stable) @NotNull public BuildSpec runScriptBuildspec(@NotNull String entrypoint)
      Make a buildspec to run the indicated script.

      Specified by:
      runScriptBuildspec in interface IBuildImage
      Parameters:
      entrypoint - This parameter is required.
    • validate

      @Stability(Stable) @NotNull public List<String> validate(@NotNull BuildEnvironment buildEnvironment)
      Allows the image a chance to validate whether the passed configuration is correct.

      Specified by:
      validate in interface IBuildImage
      Parameters:
      buildEnvironment - This parameter is required.
    • getDefaultComputeType

      @Stability(Stable) @NotNull public ComputeType getDefaultComputeType()
      The default ComputeType to use with this image, if one was not specified in BuildEnvironment#computeType explicitly.
      Specified by:
      getDefaultComputeType in interface IBuildImage
    • getImageId

      @Stability(Stable) @NotNull public String getImageId()
      The Docker image identifier that the build environment uses.
      Specified by:
      getImageId in interface IBuildImage
      See Also:
    • getType

      @Stability(Stable) @NotNull public String getType()
      The type of build environment.
      Specified by:
      getType in interface IBuildImage
    • getImagePullPrincipalType

      @Stability(Stable) @Nullable public ImagePullPrincipalType getImagePullPrincipalType()
      The type of principal that CodeBuild will use to pull this build Docker image.
      Specified by:
      getImagePullPrincipalType in interface IBuildImage
    • getRepository

      @Stability(Stable) @Nullable public IRepository getRepository()
      An optional ECR repository that the image is hosted in.
      Specified by:
      getRepository in interface IBuildImage
    • getSecretsManagerCredentials

      @Stability(Stable) @Nullable public ISecret getSecretsManagerCredentials()
      The secretsManagerCredentials for access to a private registry.
      Specified by:
      getSecretsManagerCredentials in interface IBuildImage