Class: AWSCDK::Pipelines::CodeBuildStepProps
- Inherits:
-
ShellStepProps
- Object
- ShellStepProps
- AWSCDK::Pipelines::CodeBuildStepProps
- Defined in:
- pipelines/code_build_step_props.rb
Overview
Construction props for a CodeBuildStep.
Instance Attribute Summary collapse
-
#action_role ⇒ AWSCDK::IAM::IRole?
readonly
Custom execution role to be used for the Code Build Action.
-
#additional_inputs ⇒ Hash{String => AWSCDK::Pipelines::IFileSetProducer}?
readonly
Additional FileSets to put in other directories.
-
#build_environment ⇒ AWSCDK::CodeBuild::BuildEnvironment?
readonly
Changes to environment.
-
#cache ⇒ AWSCDK::CodeBuild::Cache?
readonly
Caching strategy to use.
-
#commands ⇒ Array<String>
readonly
Commands to run.
-
#env ⇒ Hash{String => String}?
readonly
Environment variables to set.
-
#env_from_cfn_outputs ⇒ Hash{String => AWSCDK::CfnOutput}?
readonly
Set environment variables based on Stack Outputs.
-
#file_system_locations ⇒ Array<AWSCDK::CodeBuild::IFileSystemLocation>?
readonly
ProjectFileSystemLocation objects for CodeBuild build projects.
-
#input ⇒ AWSCDK::Pipelines::IFileSetProducer?
readonly
FileSet to run these scripts on.
-
#install_commands ⇒ Array<String>?
readonly
Installation commands to run before the regular commands.
-
#logging ⇒ AWSCDK::CodeBuild::LoggingOptions?
readonly
Information about logs for CodeBuild projects.
-
#partial_build_spec ⇒ AWSCDK::CodeBuild::BuildSpec?
readonly
Additional configuration that can only be configured via BuildSpec.
-
#primary_output_directory ⇒ String?
readonly
The directory that will contain the primary output fileset.
-
#project_name ⇒ String?
readonly
Name for the generated CodeBuild project.
-
#role ⇒ AWSCDK::IAM::IRole?
readonly
Custom execution role to be used for the CodeBuild project.
-
#role_policy_statements ⇒ Array<AWSCDK::IAM::PolicyStatement>?
readonly
Policy statements to add to role used during the synth.
-
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
readonly
Which security group to associate with the script's project network interfaces.
-
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection?
readonly
Which subnets to use.
-
#timeout ⇒ AWSCDK::Duration?
readonly
The number of minutes after which AWS CodeBuild stops the build if it's not complete.
-
#vpc ⇒ AWSCDK::EC2::IVPC?
readonly
The VPC where to execute the SimpleSynth.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(commands:, additional_inputs: nil, env: nil, env_from_cfn_outputs: nil, input: nil, install_commands: nil, primary_output_directory: nil, action_role: nil, build_environment: nil, cache: nil, file_system_locations: nil, logging: nil, partial_build_spec: nil, project_name: nil, role: nil, role_policy_statements: nil, security_groups: nil, subnet_selection: nil, timeout: nil, vpc: nil) ⇒ CodeBuildStepProps
constructor
A new instance of CodeBuildStepProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(commands:, additional_inputs: nil, env: nil, env_from_cfn_outputs: nil, input: nil, install_commands: nil, primary_output_directory: nil, action_role: nil, build_environment: nil, cache: nil, file_system_locations: nil, logging: nil, partial_build_spec: nil, project_name: nil, role: nil, role_policy_statements: nil, security_groups: nil, subnet_selection: nil, timeout: nil, vpc: nil) ⇒ CodeBuildStepProps
Returns a new instance of CodeBuildStepProps.
27 28 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 |
# File 'pipelines/code_build_step_props.rb', line 27 def initialize(commands:, additional_inputs: nil, env: nil, env_from_cfn_outputs: nil, input: nil, install_commands: nil, primary_output_directory: nil, action_role: nil, build_environment: nil, cache: nil, file_system_locations: nil, logging: nil, partial_build_spec: nil, project_name: nil, role: nil, role_policy_statements: nil, security_groups: nil, subnet_selection: nil, timeout: nil, vpc: nil) @commands = commands Jsii::Type.check_type(@commands, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "commands") @additional_inputs = additional_inputs Jsii::Type.check_type(@additional_inputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLnBpcGVsaW5lcy5JRmlsZVNldFByb2R1Y2VyIn0sImtpbmQiOiJtYXAifX0=")), "additionalInputs") unless @additional_inputs.nil? @env = env Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "env") unless @env.nil? @env_from_cfn_outputs = env_from_cfn_outputs Jsii::Type.check_type(@env_from_cfn_outputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmbk91dHB1dCJ9LCJraW5kIjoibWFwIn19")), "envFromCfnOutputs") unless @env_from_cfn_outputs.nil? @input = input Jsii::Type.check_type(@input, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuSUZpbGVTZXRQcm9kdWNlciJ9")), "input") unless @input.nil? @install_commands = install_commands Jsii::Type.check_type(@install_commands, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "installCommands") unless @install_commands.nil? @primary_output_directory = primary_output_directory Jsii::Type.check_type(@primary_output_directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "primaryOutputDirectory") unless @primary_output_directory.nil? @action_role = action_role Jsii::Type.check_type(@action_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "actionRole") unless @action_role.nil? @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") unless @build_environment.nil? @cache = cache Jsii::Type.check_type(@cache, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkNhY2hlIn0=")), "cache") unless @cache.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? @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? @partial_build_spec = partial_build_spec Jsii::Type.check_type(@partial_build_spec, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkJ1aWxkU3BlYyJ9")), "partialBuildSpec") unless @partial_build_spec.nil? @project_name = project_name Jsii::Type.check_type(@project_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "projectName") unless @project_name.nil? @role = role Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil? @role_policy_statements = role_policy_statements Jsii::Type.check_type(@role_policy_statements, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uUG9saWN5U3RhdGVtZW50In0sImtpbmQiOiJhcnJheSJ9fQ==")), "rolePolicyStatements") unless @role_policy_statements.nil? @security_groups = security_groups Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.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? @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless @vpc.nil? end |
Instance Attribute Details
#action_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - A role is automatically created
Custom execution role to be used for the Code Build Action.
142 143 144 |
# File 'pipelines/code_build_step_props.rb', line 142 def action_role @action_role end |
#additional_inputs ⇒ Hash{String => AWSCDK::Pipelines::IFileSetProducer}? (readonly)
Default: - No additional inputs
Additional FileSets to put in other directories.
Specifies a mapping from directory name to FileSets. During the script execution, the FileSets will be available in the directories indicated.
The directory names may be relative. For example, you can put the main input and an additional input side-by-side with the following configuration:
# Example automatically generated from non-compiling source. May contain errors.
script = Pipelines::ShellStep.new("MainScript", {
commands: ["npm ci", "npm run build", "npx cdk synth"],
input: Pipelines::CodePipelineSource.git_hub("org/source1", "main"),
additional_inputs: {
"../siblingdir" => Pipelines::CodePipelineSource.git_hub("org/source2", "main"),
},
})
97 98 99 |
# File 'pipelines/code_build_step_props.rb', line 97 def additional_inputs @additional_inputs end |
#build_environment ⇒ AWSCDK::CodeBuild::BuildEnvironment? (readonly)
Default: - Use the pipeline's default build environment
Changes to environment.
This environment will be combined with the pipeline's default environment.
150 151 152 |
# File 'pipelines/code_build_step_props.rb', line 150 def build_environment @build_environment end |
#cache ⇒ AWSCDK::CodeBuild::Cache? (readonly)
Default: - No cache
Caching strategy to use.
155 156 157 |
# File 'pipelines/code_build_step_props.rb', line 155 def cache @cache end |
#commands ⇒ Array<String> (readonly)
Commands to run.
73 74 75 |
# File 'pipelines/code_build_step_props.rb', line 73 def commands @commands end |
#env ⇒ Hash{String => String}? (readonly)
Default: - No environment variables
Environment variables to set.
102 103 104 |
# File 'pipelines/code_build_step_props.rb', line 102 def env @env end |
#env_from_cfn_outputs ⇒ Hash{String => AWSCDK::CfnOutput}? (readonly)
Default: - No environment variables created from stack outputs
Set environment variables based on Stack Outputs.
ShellSteps following stack or stage deployments may
access the CfnOutputs of those stacks to get access to
--for example--automatically generated resource names or
endpoint URLs.
112 113 114 |
# File 'pipelines/code_build_step_props.rb', line 112 def env_from_cfn_outputs @env_from_cfn_outputs end |
#file_system_locations ⇒ Array<AWSCDK::CodeBuild::IFileSystemLocation>? (readonly)
Default: - no file system locations
ProjectFileSystemLocation objects for CodeBuild build projects.
A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, and type of a file system created using Amazon Elastic File System.
163 164 165 |
# File 'pipelines/code_build_step_props.rb', line 163 def file_system_locations @file_system_locations end |
#input ⇒ AWSCDK::Pipelines::IFileSetProducer? (readonly)
Default: - No input specified
FileSet to run these scripts on.
The files in the FileSet will be placed in the working directory when
the script is executed. Use additional_inputs to download file sets
to other directories as well.
121 122 123 |
# File 'pipelines/code_build_step_props.rb', line 121 def input @input end |
#install_commands ⇒ Array<String>? (readonly)
Default: - No installation commands
Installation commands to run before the regular commands.
For deployment engines that support it, install commands will be classified
differently in the job history from the regular commands.
129 130 131 |
# File 'pipelines/code_build_step_props.rb', line 129 def install_commands @install_commands end |
#logging ⇒ AWSCDK::CodeBuild::LoggingOptions? (readonly)
Default: - no log configuration is set
Information about logs for CodeBuild projects.
A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.
170 171 172 |
# File 'pipelines/code_build_step_props.rb', line 170 def logging @logging end |
#partial_build_spec ⇒ AWSCDK::CodeBuild::BuildSpec? (readonly)
Default: - BuildSpec completely derived from other properties
Additional configuration that can only be configured via BuildSpec.
You should not use this to specify output artifacts; those should be supplied via the other properties of this class, otherwise CDK Pipelines won't be able to inspect the artifacts.
Set the commands to an empty array if you want to fully specify
the BuildSpec using this field.
The BuildSpec must be available inline--it cannot reference a file on disk.
185 186 187 |
# File 'pipelines/code_build_step_props.rb', line 185 def partial_build_spec @partial_build_spec end |
#primary_output_directory ⇒ String? (readonly)
Default: - No primary output
The directory that will contain the primary output fileset.
After running the script, the contents of the given directory will be treated as the primary output of this Step.
137 138 139 |
# File 'pipelines/code_build_step_props.rb', line 137 def primary_output_directory @primary_output_directory end |
#project_name ⇒ String? (readonly)
Default: - Automatically generated
Name for the generated CodeBuild project.
190 191 192 |
# File 'pipelines/code_build_step_props.rb', line 190 def project_name @project_name end |
#role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - A role is automatically created
Custom execution role to be used for the CodeBuild project.
195 196 197 |
# File 'pipelines/code_build_step_props.rb', line 195 def role @role end |
#role_policy_statements ⇒ Array<AWSCDK::IAM::PolicyStatement>? (readonly)
Default: - No policy statements added to CodeBuild Project Role
Policy statements to add to role used during the synth.
Can be used to add access to a CodeArtifact repository etc.
202 203 204 |
# File 'pipelines/code_build_step_props.rb', line 202 def role_policy_statements @role_policy_statements end |
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>? (readonly)
Default: - Security group will be automatically created.
Which security group to associate with the script's project network interfaces.
If no security group is identified, one will be created automatically.
Only used if 'vpc' is supplied.
211 212 213 |
# File 'pipelines/code_build_step_props.rb', line 211 def security_groups @security_groups end |
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: - All private subnets.
Which subnets to use.
Only used if 'vpc' is supplied.
218 219 220 |
# File 'pipelines/code_build_step_props.rb', line 218 def subnet_selection @subnet_selection end |
#timeout ⇒ AWSCDK::Duration? (readonly)
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.
226 227 228 |
# File 'pipelines/code_build_step_props.rb', line 226 def timeout @timeout end |
#vpc ⇒ AWSCDK::EC2::IVPC? (readonly)
Default: - No VPC
The VPC where to execute the SimpleSynth.
231 232 233 |
# File 'pipelines/code_build_step_props.rb', line 231 def vpc @vpc end |
Class Method Details
.jsii_properties ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'pipelines/code_build_step_props.rb', line 233 def self.jsii_properties { :commands => "commands", :additional_inputs => "additionalInputs", :env => "env", :env_from_cfn_outputs => "envFromCfnOutputs", :input => "input", :install_commands => "installCommands", :primary_output_directory => "primaryOutputDirectory", :action_role => "actionRole", :build_environment => "buildEnvironment", :cache => "cache", :file_system_locations => "fileSystemLocations", :logging => "logging", :partial_build_spec => "partialBuildSpec", :project_name => "projectName", :role => "role", :role_policy_statements => "rolePolicyStatements", :security_groups => "securityGroups", :subnet_selection => "subnetSelection", :timeout => "timeout", :vpc => "vpc", } end |
Instance Method Details
#to_jsii ⇒ Object
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 284 |
# File 'pipelines/code_build_step_props.rb', line 258 def to_jsii result = {} result.merge!(super) result.merge!({ "commands" => @commands, "additionalInputs" => @additional_inputs, "env" => @env, "envFromCfnOutputs" => @env_from_cfn_outputs, "input" => @input, "installCommands" => @install_commands, "primaryOutputDirectory" => @primary_output_directory, "actionRole" => @action_role, "buildEnvironment" => @build_environment, "cache" => @cache, "fileSystemLocations" => @file_system_locations, "logging" => @logging, "partialBuildSpec" => @partial_build_spec, "projectName" => @project_name, "role" => @role, "rolePolicyStatements" => @role_policy_statements, "securityGroups" => @security_groups, "subnetSelection" => @subnet_selection, "timeout" => @timeout, "vpc" => @vpc, }) result.compact end |