Class: AWSCDK::CodeBuild::CfnProject::EnvironmentProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CodeBuild::CfnProject::EnvironmentProperty
- Defined in:
- code_build/cfn_project.rb
Overview
Environment is a property of the AWS::CodeBuild::Project resource that specifies the environment for an AWS CodeBuild project.
Instance Attribute Summary collapse
-
#certificate ⇒ String?
readonly
The ARN of the Amazon S3 bucket, path prefix, and object key that contains the PEM-encoded certificate for the build project.
-
#compute_type ⇒ String
readonly
The type of compute environment.
- #docker_server ⇒ AWSCDK::IResolvable, ... readonly
-
#environment_variables ⇒ AWSCDK::IResolvable, ...
readonly
A set of environment variables to make available to builds for this build project.
- #fleet ⇒ AWSCDK::IResolvable, ... readonly
-
#image ⇒ String
readonly
The image tag or image digest that identifies the Docker image to use for this build project.
-
#image_pull_credentials_type ⇒ String?
readonly
The type of credentials AWS CodeBuild uses to pull images in your build.
-
#privileged_mode ⇒ Boolean, ...
readonly
Enables running the Docker daemon inside a Docker container.
-
#registry_credential ⇒ AWSCDK::IResolvable, ...
readonly
RegistryCredentialis a property of the AWS::CodeBuild::Project Environment property that specifies information about credentials that provide access to a private Docker registry. -
#type ⇒ String
readonly
The type of build environment to use for related builds.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(compute_type:, image:, type:, certificate: nil, docker_server: nil, environment_variables: nil, fleet: nil, image_pull_credentials_type: nil, privileged_mode: nil, registry_credential: nil) ⇒ EnvironmentProperty
constructor
A new instance of EnvironmentProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(compute_type:, image:, type:, certificate: nil, docker_server: nil, environment_variables: nil, fleet: nil, image_pull_credentials_type: nil, privileged_mode: nil, registry_credential: nil) ⇒ EnvironmentProperty
Returns a new instance of EnvironmentProperty.
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'code_build/cfn_project.rb', line 1240 def initialize(compute_type:, image:, type:, certificate: nil, docker_server: nil, environment_variables: nil, fleet: nil, image_pull_credentials_type: nil, privileged_mode: nil, registry_credential: nil) @compute_type = compute_type Jsii::Type.check_type(@compute_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "computeType") @image = image Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image") @type = type Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type") @certificate = certificate Jsii::Type.check_type(@certificate, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "certificate") unless @certificate.nil? @docker_server = docker_server.is_a?(Hash) ? ::AWSCDK::CodeBuild::CfnProject::DockerServerProperty.new(**docker_server.transform_keys(&:to_sym)) : docker_server Jsii::Type.check_type(@docker_server, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQ2ZuUHJvamVjdC5Eb2NrZXJTZXJ2ZXJQcm9wZXJ0eSJ9XX19")), "dockerServer") unless @docker_server.nil? @environment_variables = environment_variables Jsii::Type.check_type(@environment_variables, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkNmblByb2plY3QuRW52aXJvbm1lbnRWYXJpYWJsZVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "environmentVariables") unless @environment_variables.nil? @fleet = fleet.is_a?(Hash) ? ::AWSCDK::CodeBuild::CfnProject::ProjectFleetProperty.new(**fleet.transform_keys(&:to_sym)) : fleet Jsii::Type.check_type(@fleet, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQ2ZuUHJvamVjdC5Qcm9qZWN0RmxlZXRQcm9wZXJ0eSJ9XX19")), "fleet") unless @fleet.nil? @image_pull_credentials_type = image_pull_credentials_type Jsii::Type.check_type(@image_pull_credentials_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imagePullCredentialsType") unless @image_pull_credentials_type.nil? @privileged_mode = privileged_mode Jsii::Type.check_type(@privileged_mode, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "privilegedMode") unless @privileged_mode.nil? @registry_credential = registry_credential.is_a?(Hash) ? ::AWSCDK::CodeBuild::CfnProject::RegistryCredentialProperty.new(**registry_credential.transform_keys(&:to_sym)) : registry_credential Jsii::Type.check_type(@registry_credential, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQ2ZuUHJvamVjdC5SZWdpc3RyeUNyZWRlbnRpYWxQcm9wZXJ0eSJ9XX19")), "registryCredential") unless @registry_credential.nil? end |
Instance Attribute Details
#certificate ⇒ String? (readonly)
The ARN of the Amazon S3 bucket, path prefix, and object key that contains the PEM-encoded certificate for the build project.
For more information, see certificate in the AWS CodeBuild User Guide .
1326 1327 1328 |
# File 'code_build/cfn_project.rb', line 1326 def certificate @certificate end |
#compute_type ⇒ String (readonly)
The type of compute environment.
This determines the number of CPU cores and memory the build environment uses. Available values include:
ATTRIBUTE_BASED_COMPUTE: Specify the amount of vCPUs, memory, disk space, and the type of machine.
If you use
ATTRIBUTE_BASED_COMPUTE, you must define your attributes by usingcompute_configuration. AWS CodeBuild will select the cheapest instance that satisfies your specified attributes. For more information, see Reserved capacity environment types in the AWS CodeBuild User Guide .
BUILD_GENERAL1_SMALL: Use up to 4 GiB memory and 2 vCPUs for builds.BUILD_GENERAL1_MEDIUM: Use up to 8 GiB memory and 4 vCPUs for builds.BUILD_GENERAL1_LARGE: Use up to 16 GiB memory and 8 vCPUs for builds, depending on your environment type.BUILD_GENERAL1_XLARGE: Use up to 72 GiB memory and 36 vCPUs for builds, depending on your environment type.BUILD_GENERAL1_2XLARGE: Use up to 144 GiB memory, 72 vCPUs, and 824 GB of SSD storage for builds. This compute type supports Docker images up to 100 GB uncompressed.BUILD_LAMBDA_1GB: Use up to 1 GiB memory for builds. Only available for environment typeLINUX_LAMBDA_CONTAINERandARM_LAMBDA_CONTAINER.BUILD_LAMBDA_2GB: Use up to 2 GiB memory for builds. Only available for environment typeLINUX_LAMBDA_CONTAINERandARM_LAMBDA_CONTAINER.BUILD_LAMBDA_4GB: Use up to 4 GiB memory for builds. Only available for environment typeLINUX_LAMBDA_CONTAINERandARM_LAMBDA_CONTAINER.BUILD_LAMBDA_8GB: Use up to 8 GiB memory for builds. Only available for environment typeLINUX_LAMBDA_CONTAINERandARM_LAMBDA_CONTAINER.BUILD_LAMBDA_10GB: Use up to 10 GiB memory for builds. Only available for environment typeLINUX_LAMBDA_CONTAINERandARM_LAMBDA_CONTAINER.
If you use BUILD_GENERAL1_SMALL :
- For environment type
LINUX_CONTAINER, you can use up to 4 GiB memory and 2 vCPUs for builds. - For environment type
LINUX_GPU_CONTAINER, you can use up to 16 GiB memory, 4 vCPUs, and 1 NVIDIA A10G Tensor Core GPU for builds. - For environment type
ARM_CONTAINER, you can use up to 4 GiB memory and 2 vCPUs on ARM-based processors for builds.
If you use BUILD_GENERAL1_LARGE :
- For environment type
LINUX_CONTAINER, you can use up to 16 GiB memory and 8 vCPUs for builds. - For environment type
LINUX_GPU_CONTAINER, you can use up to 255 GiB memory, 32 vCPUs, and 4 NVIDIA Tesla V100 GPUs for builds. - For environment type
ARM_CONTAINER, you can use up to 16 GiB memory and 8 vCPUs on ARM-based processors for builds.
For more information, see On-demand environment types in the AWS CodeBuild User Guide.
1298 1299 1300 |
# File 'code_build/cfn_project.rb', line 1298 def compute_type @compute_type end |
#docker_server ⇒ AWSCDK::IResolvable, ... (readonly)
1329 1330 1331 |
# File 'code_build/cfn_project.rb', line 1329 def docker_server @docker_server end |
#environment_variables ⇒ AWSCDK::IResolvable, ... (readonly)
A set of environment variables to make available to builds for this build project.
1334 1335 1336 |
# File 'code_build/cfn_project.rb', line 1334 def environment_variables @environment_variables end |
#fleet ⇒ AWSCDK::IResolvable, ... (readonly)
1337 1338 1339 |
# File 'code_build/cfn_project.rb', line 1337 def fleet @fleet end |
#image ⇒ String (readonly)
The image tag or image digest that identifies the Docker image to use for this build project.
Use the following formats:
- For an image tag:
<registry>/<repository>:<tag>. For example, in the Docker repository that CodeBuild uses to manage its Docker images, this would beaws/codebuild/standard:4.0. - For an image digest:
<registry>/<repository>@<digest>. For example, to specify an image with the digest "sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf," use<registry>/<repository>@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf.
For more information, see Docker images provided by CodeBuild in the AWS CodeBuild user guide .
1310 1311 1312 |
# File 'code_build/cfn_project.rb', line 1310 def image @image end |
#image_pull_credentials_type ⇒ String? (readonly)
The type of credentials AWS CodeBuild uses to pull images in your build. There are two valid values:.
CODEBUILDspecifies that AWS CodeBuild uses its own credentials. This requires that you modify your ECR repository policy to trust AWS CodeBuild service principal.SERVICE_ROLEspecifies that AWS CodeBuild uses your build project's service role.
When you use a cross-account or private registry image, you must use SERVICE_ROLE credentials. When you use an AWS CodeBuild curated image, you must use CODEBUILD credentials.
1347 1348 1349 |
# File 'code_build/cfn_project.rb', line 1347 def image_pull_credentials_type @image_pull_credentials_type end |
#privileged_mode ⇒ Boolean, ... (readonly)
Enables running the Docker daemon inside a Docker container.
Set to true only if the build project is used to build Docker images. Otherwise, a build that attempts to interact with the Docker daemon fails. The default setting is false .
You can initialize the Docker daemon during the install phase of your build by adding one of the following sets of commands to the install phase of your buildspec file:
If the operating system's base image is Ubuntu Linux:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=overlay&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
If the operating system's base image is Alpine Linux and the previous command does not work, add the -t argument to timeout :
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=overlay&
- timeout -t 15 sh -c "until docker info; do echo .; sleep 1; done"
1368 1369 1370 |
# File 'code_build/cfn_project.rb', line 1368 def privileged_mode @privileged_mode end |
#registry_credential ⇒ AWSCDK::IResolvable, ... (readonly)
RegistryCredential is a property of the AWS::CodeBuild::Project Environment property that specifies information about credentials that provide access to a private Docker registry. When this is set:.
image_pull_credentials_typemust be set toSERVICE_ROLE.- images cannot be curated or an Amazon ECR image.
1376 1377 1378 |
# File 'code_build/cfn_project.rb', line 1376 def registry_credential @registry_credential end |
#type ⇒ String (readonly)
The type of build environment to use for related builds.
If you're using compute fleets during project creation,
typewill be ignored.
For more information, see Build environment compute types in the AWS CodeBuild user guide .
1319 1320 1321 |
# File 'code_build/cfn_project.rb', line 1319 def type @type end |
Class Method Details
.jsii_properties ⇒ Object
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
# File 'code_build/cfn_project.rb', line 1378 def self.jsii_properties { :compute_type => "computeType", :image => "image", :type => "type", :certificate => "certificate", :docker_server => "dockerServer", :environment_variables => "environmentVariables", :fleet => "fleet", :image_pull_credentials_type => "imagePullCredentialsType", :privileged_mode => "privilegedMode", :registry_credential => "registryCredential", } end |
Instance Method Details
#to_jsii ⇒ Object
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 |
# File 'code_build/cfn_project.rb', line 1393 def to_jsii result = {} result.merge!({ "computeType" => @compute_type, "image" => @image, "type" => @type, "certificate" => @certificate, "dockerServer" => @docker_server, "environmentVariables" => @environment_variables, "fleet" => @fleet, "imagePullCredentialsType" => @image_pull_credentials_type, "privilegedMode" => @privileged_mode, "registryCredential" => @registry_credential, }) result.compact end |