Class: AWSCDK::CodeBuild::CommonProjectProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
code_build/common_project_props.rb

Direct Known Subclasses

PipelineProjectProps, ProjectProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_all_outbound: nil, auto_retry_limit: nil, badge: nil, build_spec: nil, cache: nil, check_secrets_in_plain_text_env_variables: nil, concurrent_build_limit: nil, description: nil, encryption_key: nil, environment: nil, environment_variables: nil, file_system_locations: nil, grant_report_group_permissions: nil, logging: nil, project_name: nil, queued_timeout: nil, role: nil, security_groups: nil, ssm_session_permissions: nil, subnet_selection: nil, timeout: nil, visibility: nil, vpc: nil) ⇒ CommonProjectProps

Returns a new instance of CommonProjectProps.

Parameters:

  • allow_all_outbound (Boolean, nil) (defaults to: nil)

    Whether to allow the CodeBuild to send all network traffic.

  • auto_retry_limit (Numeric, nil) (defaults to: nil)

    CodeBuild will automatically call retry build using the project's service role up to the auto-retry limit.

  • badge (Boolean, nil) (defaults to: nil)

    Indicates whether AWS CodeBuild generates a publicly accessible URL for your project's build badge.

  • build_spec (AWSCDK::CodeBuild::BuildSpec, nil) (defaults to: nil)

    Filename or contents of buildspec in JSON format.

  • cache (AWSCDK::CodeBuild::Cache, nil) (defaults to: nil)

    Caching strategy to use.

  • check_secrets_in_plain_text_env_variables (Boolean, nil) (defaults to: nil)

    Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.

  • concurrent_build_limit (Numeric, nil) (defaults to: nil)

    Maximum number of concurrent builds.

  • description (String, nil) (defaults to: nil)

    A description of the project.

  • encryption_key (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    Encryption key to use to read and write artifacts.

  • environment (AWSCDK::CodeBuild::BuildEnvironment, nil) (defaults to: nil)

    Build environment to use for the build.

  • environment_variables (Hash{String => AWSCDK::CodeBuild::BuildEnvironmentVariable}, nil) (defaults to: nil)

    Additional environment variables to add to the build environment.

  • file_system_locations (Array<AWSCDK::CodeBuild::IFileSystemLocation>, nil) (defaults to: nil)

    An ProjectFileSystemLocation objects for a CodeBuild build project.

  • grant_report_group_permissions (Boolean, nil) (defaults to: nil)

    Add permissions to this project's role to create and use test report groups with name starting with the name of this project.

  • logging (AWSCDK::CodeBuild::LoggingOptions, nil) (defaults to: nil)

    Information about logs for the build project.

  • project_name (String, nil) (defaults to: nil)

    The physical, human-readable name of the CodeBuild Project.

  • queued_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The number of minutes after which AWS CodeBuild stops the build if it's still in queue.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    Service Role to assume while running the build.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    What security group to associate with the codebuild project's network interfaces.

  • ssm_session_permissions (Boolean, nil) (defaults to: nil)

    Add the permissions necessary for debugging builds with SSM Session Manager.

  • subnet_selection (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    Where to place the network interfaces within the VPC.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The number of minutes after which AWS CodeBuild stops the build if it's not complete.

  • visibility (AWSCDK::CodeBuild::ProjectVisibility, nil) (defaults to: nil)

    Specifies the visibility of the project's builds.

  • vpc (AWSCDK::EC2::IVPC, nil) (defaults to: nil)

    VPC network to place codebuild network interfaces.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'code_build/common_project_props.rb', line 29

def initialize(allow_all_outbound: nil, auto_retry_limit: nil, badge: nil, build_spec: nil, cache: nil, check_secrets_in_plain_text_env_variables: nil, concurrent_build_limit: nil, description: nil, encryption_key: nil, environment: nil, environment_variables: nil, file_system_locations: nil, grant_report_group_permissions: nil, logging: nil, project_name: nil, queued_timeout: nil, role: nil, security_groups: nil, ssm_session_permissions: nil, subnet_selection: nil, timeout: nil, visibility: nil, vpc: nil)
  @allow_all_outbound = allow_all_outbound
  Jsii::Type.check_type(@allow_all_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllOutbound") unless @allow_all_outbound.nil?
  @auto_retry_limit = auto_retry_limit
  Jsii::Type.check_type(@auto_retry_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "autoRetryLimit") unless @auto_retry_limit.nil?
  @badge = badge
  Jsii::Type.check_type(@badge, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "badge") unless @badge.nil?
  @build_spec = build_spec
  Jsii::Type.check_type(@build_spec, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkJ1aWxkU3BlYyJ9")), "buildSpec") unless @build_spec.nil?
  @cache = cache
  Jsii::Type.check_type(@cache, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkNhY2hlIn0=")), "cache") unless @cache.nil?
  @check_secrets_in_plain_text_env_variables = check_secrets_in_plain_text_env_variables
  Jsii::Type.check_type(@check_secrets_in_plain_text_env_variables, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "checkSecretsInPlainTextEnvVariables") unless @check_secrets_in_plain_text_env_variables.nil?
  @concurrent_build_limit = concurrent_build_limit
  Jsii::Type.check_type(@concurrent_build_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "concurrentBuildLimit") unless @concurrent_build_limit.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @encryption_key = encryption_key
  Jsii::Type.check_type(@encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "encryptionKey") unless @encryption_key.nil?
  @environment = environment.is_a?(Hash) ? ::AWSCDK::CodeBuild::BuildEnvironment.new(**environment.transform_keys(&:to_sym)) : environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkJ1aWxkRW52aXJvbm1lbnQifQ==")), "environment") unless @environment.nil?
  @environment_variables = environment_variables.is_a?(Hash) ? environment_variables.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CodeBuild::BuildEnvironmentVariable.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : environment_variables
  Jsii::Type.check_type(@environment_variables, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQnVpbGRFbnZpcm9ubWVudFZhcmlhYmxlIn0sImtpbmQiOiJtYXAifX0=")), "environmentVariables") unless @environment_variables.nil?
  @file_system_locations = file_system_locations
  Jsii::Type.check_type(@file_system_locations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuSUZpbGVTeXN0ZW1Mb2NhdGlvbiJ9LCJraW5kIjoiYXJyYXkifX0=")), "fileSystemLocations") unless @file_system_locations.nil?
  @grant_report_group_permissions = grant_report_group_permissions
  Jsii::Type.check_type(@grant_report_group_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "grantReportGroupPermissions") unless @grant_report_group_permissions.nil?
  @logging = logging.is_a?(Hash) ? ::AWSCDK::CodeBuild::LoggingOptions.new(**logging.transform_keys(&:to_sym)) : logging
  Jsii::Type.check_type(@logging, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkxvZ2dpbmdPcHRpb25zIn0=")), "logging") unless @logging.nil?
  @project_name = project_name
  Jsii::Type.check_type(@project_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "projectName") unless @project_name.nil?
  @queued_timeout = queued_timeout
  Jsii::Type.check_type(@queued_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "queuedTimeout") unless @queued_timeout.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @ssm_session_permissions = ssm_session_permissions
  Jsii::Type.check_type(@ssm_session_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ssmSessionPermissions") unless @ssm_session_permissions.nil?
  @subnet_selection = subnet_selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**subnet_selection.transform_keys(&:to_sym)) : subnet_selection
  Jsii::Type.check_type(@subnet_selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "subnetSelection") unless @subnet_selection.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
  @visibility = visibility
  Jsii::Type.check_type(@visibility, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLlByb2plY3RWaXNpYmlsaXR5In0=")), "visibility") unless @visibility.nil?
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil?
end

Instance Attribute Details

#allow_all_outboundBoolean? (readonly)

Note:

Default: true

Whether to allow the CodeBuild to send all network traffic.

If set to false, you must individually add traffic rules to allow the CodeBuild project to connect to network targets.

Only used if 'vpc' is supplied.

Returns:

  • (Boolean, nil)


87
88
89
# File 'code_build/common_project_props.rb', line 87

def allow_all_outbound
  @allow_all_outbound
end

#auto_retry_limitNumeric? (readonly)

Note:

Default: - no retry

CodeBuild will automatically call retry build using the project's service role up to the auto-retry limit.

auto_retry_limit must be between 0 and 10.

Returns:

  • (Numeric, nil)


94
95
96
# File 'code_build/common_project_props.rb', line 94

def auto_retry_limit
  @auto_retry_limit
end

#badgeBoolean? (readonly)

Note:

Default: false

Indicates whether AWS CodeBuild generates a publicly accessible URL for your project's build badge.

For more information, see Build Badges Sample in the AWS CodeBuild User Guide.

Returns:

  • (Boolean, nil)


102
103
104
# File 'code_build/common_project_props.rb', line 102

def badge
  @badge
end

#build_specAWSCDK::CodeBuild::BuildSpec? (readonly)

Note:

Default: - Empty buildspec.

Filename or contents of buildspec in JSON format.



108
109
110
# File 'code_build/common_project_props.rb', line 108

def build_spec
  @build_spec
end

#cacheAWSCDK::CodeBuild::Cache? (readonly)

Note:

Default: Cache.none

Caching strategy to use.

Returns:



113
114
115
# File 'code_build/common_project_props.rb', line 113

def cache
  @cache
end

#check_secrets_in_plain_text_env_variablesBoolean? (readonly)

Note:

Default: true

Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable.

Returns:

  • (Boolean, nil)


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

def check_secrets_in_plain_text_env_variables
  @check_secrets_in_plain_text_env_variables
end

#concurrent_build_limitNumeric? (readonly)

Note:

Default: - no explicit limit is set

Maximum number of concurrent builds.

Minimum value is 1 and maximum is account build limit.

Returns:

  • (Numeric, nil)


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

def concurrent_build_limit
  @concurrent_build_limit
end

#descriptionString? (readonly)

Note:

Default: - No description.

A description of the project.

Use the description to identify the purpose of the project.

Returns:

  • (String, nil)


133
134
135
# File 'code_build/common_project_props.rb', line 133

def description
  @description
end

#encryption_keyAWSCDK::KMS::IKey? (readonly)

Note:

Default: - The AWS-managed CMK for Amazon Simple Storage Service (Amazon S3) is used.

Encryption key to use to read and write artifacts.

Returns:



138
139
140
# File 'code_build/common_project_props.rb', line 138

def encryption_key
  @encryption_key
end

#environmentAWSCDK::CodeBuild::BuildEnvironment? (readonly)

Note:

Default: BuildEnvironment.LinuxBuildImage.STANDARD_7_0

Build environment to use for the build.



143
144
145
# File 'code_build/common_project_props.rb', line 143

def environment
  @environment
end

#environment_variablesHash{String => AWSCDK::CodeBuild::BuildEnvironmentVariable}? (readonly)

Note:

Default: - No additional environment variables are specified.

Additional environment variables to add to the build environment.

Returns:



148
149
150
# File 'code_build/common_project_props.rb', line 148

def environment_variables
  @environment_variables
end

#file_system_locationsArray<AWSCDK::CodeBuild::IFileSystemLocation>? (readonly)

Note:

Default: - no file system locations

An ProjectFileSystemLocation objects for a CodeBuild build project.

A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, and type of a file system created using Amazon Elastic File System.



156
157
158
# File 'code_build/common_project_props.rb', line 156

def file_system_locations
  @file_system_locations
end

#grant_report_group_permissionsBoolean? (readonly)

Note:

Default: true

Add permissions to this project's role to create and use test report groups with name starting with the name of this project.

That is the standard report group that gets created when a simple name (in contrast to an ARN) is used in the 'reports' section of the buildspec of this project. This is usually harmless, but you can turn these off if you don't plan on using test reports in this project.



168
169
170
# File 'code_build/common_project_props.rb', line 168

def grant_report_group_permissions
  @grant_report_group_permissions
end

#loggingAWSCDK::CodeBuild::LoggingOptions? (readonly)

Note:

Default: - no log configuration is set

Information about logs for the build project.

A project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.



175
176
177
# File 'code_build/common_project_props.rb', line 175

def logging
  @logging
end

#project_nameString? (readonly)

Note:

Default: - Name is automatically generated.

The physical, human-readable name of the CodeBuild Project.

Returns:

  • (String, nil)


180
181
182
# File 'code_build/common_project_props.rb', line 180

def project_name
  @project_name
end

#queued_timeoutAWSCDK::Duration? (readonly)

Note:

Default: - no queue timeout is set

The number of minutes after which AWS CodeBuild stops the build if it's still in queue.

For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.

Returns:



188
189
190
# File 'code_build/common_project_props.rb', line 188

def queued_timeout
  @queued_timeout
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A role will be created.

Service Role to assume while running the build.

Returns:



193
194
195
# File 'code_build/common_project_props.rb', line 193

def role
  @role
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: - Security group will be automatically created.

What security group to associate with the codebuild project's network interfaces.

If no security group is identified, one will be created automatically.

Only used if 'vpc' is supplied.

Returns:



202
203
204
# File 'code_build/common_project_props.rb', line 202

def security_groups
  @security_groups
end

#ssm_session_permissionsBoolean? (readonly)

Note:

Default: false

Add the permissions necessary for debugging builds with SSM Session Manager.

If the following prerequisites have been met:

  • The necessary permissions have been added by setting this flag to true.
  • The build image has the SSM agent installed (true for default CodeBuild images).
  • The build is started with debugSessionEnabled set to true.

Then the build container can be paused and inspected using Session Manager by invoking the codebuild-breakpoint command somewhere during the build.

codebuild-breakpoint commands will be ignored if the build is not started with debugSessionEnabled=true.



220
221
222
# File 'code_build/common_project_props.rb', line 220

def ssm_session_permissions
  @ssm_session_permissions
end

#subnet_selectionAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - private subnets if available else public subnets

Where to place the network interfaces within the VPC.

To access AWS services, your CodeBuild project needs to be in one of the following types of subnets:

  1. Subnets with access to the internet (of type PRIVATE_WITH_EGRESS).
  2. Private subnets unconnected to the internet, but with VPC endpoints for the necessary services.

If you don't specify a subnet selection, the default behavior is to use PRIVATE_WITH_EGRESS subnets first if they exist, then PRIVATE_WITHOUT_EGRESS, and finally PUBLIC subnets. If your VPC doesn't have PRIVATE_WITH_EGRESS subnets but you need AWS service access, add VPC Endpoints to your private subnets.



235
236
237
# File 'code_build/common_project_props.rb', line 235

def subnet_selection
  @subnet_selection
end

#timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(1)

The number of minutes after which AWS CodeBuild stops the build if it's not complete.

For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.

Returns:



243
244
245
# File 'code_build/common_project_props.rb', line 243

def timeout
  @timeout
end

#visibilityAWSCDK::CodeBuild::ProjectVisibility? (readonly)

Note:

Default: - no visibility is set

Specifies the visibility of the project's builds.



248
249
250
# File 'code_build/common_project_props.rb', line 248

def visibility
  @visibility
end

#vpcAWSCDK::EC2::IVPC? (readonly)

Note:

Default: - No VPC is specified.

VPC network to place codebuild network interfaces.

Specify this if the codebuild project needs to access resources in a VPC.

Returns:



255
256
257
# File 'code_build/common_project_props.rb', line 255

def vpc
  @vpc
end

Class Method Details

.jsii_propertiesObject



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'code_build/common_project_props.rb', line 257

def self.jsii_properties
  {
    :allow_all_outbound => "allowAllOutbound",
    :auto_retry_limit => "autoRetryLimit",
    :badge => "badge",
    :build_spec => "buildSpec",
    :cache => "cache",
    :check_secrets_in_plain_text_env_variables => "checkSecretsInPlainTextEnvVariables",
    :concurrent_build_limit => "concurrentBuildLimit",
    :description => "description",
    :encryption_key => "encryptionKey",
    :environment => "environment",
    :environment_variables => "environmentVariables",
    :file_system_locations => "fileSystemLocations",
    :grant_report_group_permissions => "grantReportGroupPermissions",
    :logging => "logging",
    :project_name => "projectName",
    :queued_timeout => "queuedTimeout",
    :role => "role",
    :security_groups => "securityGroups",
    :ssm_session_permissions => "ssmSessionPermissions",
    :subnet_selection => "subnetSelection",
    :timeout => "timeout",
    :visibility => "visibility",
    :vpc => "vpc",
  }
end

Instance Method Details

#to_jsiiObject



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'code_build/common_project_props.rb', line 285

def to_jsii
  result = {}
  result.merge!({
    "allowAllOutbound" => @allow_all_outbound,
    "autoRetryLimit" => @auto_retry_limit,
    "badge" => @badge,
    "buildSpec" => @build_spec,
    "cache" => @cache,
    "checkSecretsInPlainTextEnvVariables" => @check_secrets_in_plain_text_env_variables,
    "concurrentBuildLimit" => @concurrent_build_limit,
    "description" => @description,
    "encryptionKey" => @encryption_key,
    "environment" => @environment,
    "environmentVariables" => @environment_variables,
    "fileSystemLocations" => @file_system_locations,
    "grantReportGroupPermissions" => @grant_report_group_permissions,
    "logging" => @logging,
    "projectName" => @project_name,
    "queuedTimeout" => @queued_timeout,
    "role" => @role,
    "securityGroups" => @security_groups,
    "ssmSessionPermissions" => @ssm_session_permissions,
    "subnetSelection" => @subnet_selection,
    "timeout" => @timeout,
    "visibility" => @visibility,
    "vpc" => @vpc,
  })
  result.compact
end