Class: AWSCDK::CodeBuild::WindowsBuildImage

Inherits:
Jsii::Object
  • Object
show all
Includes:
IBuildImage
Defined in:
code_build/windows_build_image.rb

Overview

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])

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ WindowsBuildImage

Returns a new instance of WindowsBuildImage.

Raises:

  • (NoMethodError)


19
20
21
# File 'code_build/windows_build_image.rb', line 19

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_codebuild.WindowsBuildImage does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.from_asset(scope, id, props, image_type = nil) ⇒ AWSCDK::CodeBuild::IBuildImage

Uses an Docker image asset as a Windows build image.

Parameters:

Returns:



43
44
45
46
47
48
49
50
# File 'code_build/windows_build_image.rb', line 43

def self.from_asset(scope, id, props, image_type = nil)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::ECRAssets::DockerImageAssetProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5Eb2NrZXJJbWFnZUFzc2V0UHJvcHMifQ==")), "props")
  Jsii::Type.check_type(image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLldpbmRvd3NJbWFnZVR5cGUifQ==")), "imageType") unless image_type.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "fromAsset", [scope, id, props, image_type])
end

.from_docker_registry(name, options = nil, image_type = nil) ⇒ AWSCDK::CodeBuild::IBuildImage

Returns a Windows build image from a Docker Hub image.

Parameters:

Returns:



56
57
58
59
60
61
62
# File 'code_build/windows_build_image.rb', line 56

def self.from_docker_registry(name, options = nil, image_type = nil)
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  options = options.is_a?(Hash) ? ::AWSCDK::CodeBuild::DockerImageOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkRvY2tlckltYWdlT3B0aW9ucyJ9")), "options") unless options.nil?
  Jsii::Type.check_type(image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLldpbmRvd3NJbWFnZVR5cGUifQ==")), "imageType") unless image_type.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "fromDockerRegistry", [name, options, image_type])
end

.from_ecr_repository(repository, tag_or_digest = nil, image_type = nil) ⇒ AWSCDK::CodeBuild::IBuildImage

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.

Parameters:

Returns:

  • (AWSCDK::CodeBuild::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.

See Also:



69
70
71
72
73
74
# File 'code_build/windows_build_image.rb', line 69

def self.from_ecr_repository(repository, tag_or_digest = nil, image_type = nil)
  Jsii::Type.check_type(repository, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLklSZXBvc2l0b3J5In0=")), "repository")
  Jsii::Type.check_type(tag_or_digest, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tagOrDigest") unless tag_or_digest.nil?
  Jsii::Type.check_type(image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLldpbmRvd3NJbWFnZVR5cGUifQ==")), "imageType") unless image_type.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "fromEcrRepository", [repository, tag_or_digest, image_type])
end

.jsii_overridable_methodsObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'code_build/windows_build_image.rb', line 23

def self.jsii_overridable_methods
  {
    :default_compute_type => { kind: :property, name: "defaultComputeType", is_optional: false },
    :image_id => { kind: :property, name: "imageId", is_optional: false },
    :type => { kind: :property, name: "type", is_optional: false },
    :image_pull_principal_type => { kind: :property, name: "imagePullPrincipalType", is_optional: true },
    :repository => { kind: :property, name: "repository", is_optional: true },
    :secrets_manager_credentials => { kind: :property, name: "secretsManagerCredentials", is_optional: true },
    :run_script_buildspec => { kind: :method, name: "runScriptBuildspec", is_optional: false },
    :validate => { kind: :method, name: "validate", is_optional: false },
  }
end

.WIN_SERVER_CORE_2019_BASEAWSCDK::CodeBuild::IBuildImage

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



79
80
81
# File 'code_build/windows_build_image.rb', line 79

def self.WIN_SERVER_CORE_2019_BASE()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "WIN_SERVER_CORE_2019_BASE")
end

.WIN_SERVER_CORE_2019_BASE_2_0AWSCDK::CodeBuild::IBuildImage

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



86
87
88
# File 'code_build/windows_build_image.rb', line 86

def self.WIN_SERVER_CORE_2019_BASE_2_0()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "WIN_SERVER_CORE_2019_BASE_2_0")
end

.WIN_SERVER_CORE_2019_BASE_3_0AWSCDK::CodeBuild::IBuildImage

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



93
94
95
# File 'code_build/windows_build_image.rb', line 93

def self.WIN_SERVER_CORE_2019_BASE_3_0()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "WIN_SERVER_CORE_2019_BASE_3_0")
end

.WIN_SERVER_CORE_2022_BASE_3_0AWSCDK::CodeBuild::IBuildImage

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 BuildEnvironment.fleet.



103
104
105
# File 'code_build/windows_build_image.rb', line 103

def self.WIN_SERVER_CORE_2022_BASE_3_0()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "WIN_SERVER_CORE_2022_BASE_3_0")
end

.WINDOWS_BASE_2_0AWSCDK::CodeBuild::IBuildImage

Deprecated.

{@link WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 } should be used instead.

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



111
112
113
# File 'code_build/windows_build_image.rb', line 111

def self.WINDOWS_BASE_2_0()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.WindowsBuildImage", "WINDOWS_BASE_2_0")
end

Instance Method Details

#default_compute_typeAWSCDK::CodeBuild::ComputeType

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



118
119
120
# File 'code_build/windows_build_image.rb', line 118

def default_compute_type()
  jsii_get_property("defaultComputeType")
end

#image_idString

The Docker image identifier that the build environment uses.

Returns:

  • (String)


125
126
127
# File 'code_build/windows_build_image.rb', line 125

def image_id()
  jsii_get_property("imageId")
end

#image_pull_principal_typeAWSCDK::CodeBuild::ImagePullPrincipalType?

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



139
140
141
# File 'code_build/windows_build_image.rb', line 139

def image_pull_principal_type()
  jsii_get_property("imagePullPrincipalType")
end

#repositoryAWSCDK::ECR::IRepository?

An optional ECR repository that the image is hosted in.

Returns:



146
147
148
# File 'code_build/windows_build_image.rb', line 146

def repository()
  jsii_get_property("repository")
end

#run_script_buildspec(entrypoint) ⇒ AWSCDK::CodeBuild::BuildSpec

Make a buildspec to run the indicated script.

Parameters:

  • entrypoint (String)

Returns:



161
162
163
164
# File 'code_build/windows_build_image.rb', line 161

def run_script_buildspec(entrypoint)
  Jsii::Type.check_type(entrypoint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "entrypoint")
  jsii_call_method("runScriptBuildspec", [entrypoint])
end

#secrets_manager_credentialsAWSCDK::SecretsManager::ISecret?

The secretsManagerCredentials for access to a private registry.



153
154
155
# File 'code_build/windows_build_image.rb', line 153

def secrets_manager_credentials()
  jsii_get_property("secretsManagerCredentials")
end

#typeString

The type of build environment.

Returns:

  • (String)


132
133
134
# File 'code_build/windows_build_image.rb', line 132

def type()
  jsii_get_property("type")
end

#validate(build_environment) ⇒ Array<String>

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

Parameters:

Returns:

  • (Array<String>)


170
171
172
173
174
# File 'code_build/windows_build_image.rb', line 170

def validate(build_environment)
  build_environment = build_environment.is_a?(Hash) ? ::AWSCDK::CodeBuild::BuildEnvironment.new(**build_environment.transform_keys(&:to_sym)) : build_environment
  Jsii::Type.check_type(build_environment, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkJ1aWxkRW52aXJvbm1lbnQifQ==")), "buildEnvironment")
  jsii_call_method("validate", [build_environment])
end