Class: AWSCDK::Pipelines::CodeBuildStep
- Inherits:
-
ShellStep
- Object
- ShellStep
- AWSCDK::Pipelines::CodeBuildStep
- Defined in:
- pipelines/code_build_step.rb
Overview
Run a script as a CodeBuild Project.
The BuildSpec must be available inline--it cannot reference a file
on disk. If your current build instructions are in a file like
buildspec.yml in your repository, extract them to a script
(say, build.sh) and invoke that script as part of the build:
AWSCDK::Pipelines::CodeBuildStep.new("Synth", {
commands: ["./build.sh"],
})
Class Method Summary collapse
Instance Method Summary collapse
-
#action_role ⇒ AWSCDK::IAM::IRole?
Custom execution role to be used for the Code Build Action.
-
#add_dependency_file_set(fs) ⇒ void
Add an additional FileSet to the set of file sets required by this step.
-
#add_output_directory(directory) ⇒ AWSCDK::Pipelines::FileSet
Add an additional output FileSet based on a directory.
-
#add_step_dependency(step) ⇒ void
Add a dependency on another step.
-
#build_environment ⇒ AWSCDK::CodeBuild::BuildEnvironment?
Build environment.
-
#cache ⇒ AWSCDK::CodeBuild::Cache?
Caching strategy to use.
-
#commands ⇒ Array<String>
Commands to run.
-
#configure_primary_output(fs) ⇒ void
Configure the given FileSet as the primary output of this step.
-
#consumed_stack_outputs ⇒ Array<AWSCDK::Pipelines::StackOutputReference>
StackOutputReferences this step consumes.
-
#dependencies ⇒ Array<AWSCDK::Pipelines::Step>
Return the steps this step depends on, based on the FileSets it requires.
-
#dependency_file_sets ⇒ Array<AWSCDK::Pipelines::FileSet>
The list of FileSets consumed by this Step.
-
#discover_referenced_outputs(structure) ⇒ void
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
-
#env ⇒ Hash{String => String}
Environment variables to set.
-
#env_from_cfn_outputs ⇒ Hash{String => AWSCDK::Pipelines::StackOutputReference}
Set environment variables based on Stack Outputs.
-
#exported_variable(variable_name) ⇒ String
Reference a CodePipeline variable defined by the CodeBuildStep.
-
#file_system_locations ⇒ Array<AWSCDK::CodeBuild::IFileSystemLocation>?
ProjectFileSystemLocation objects for CodeBuild build projects.
-
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The CodeBuild Project's principal.
-
#id ⇒ String
Identifier for this step.
-
#initialize(id, props) ⇒ CodeBuildStep
constructor
A new instance of CodeBuildStep.
-
#inputs ⇒ Array<AWSCDK::Pipelines::FileSetLocation>
Input FileSets.
-
#install_commands ⇒ Array<String>
Installation commands to run before the regular commands.
-
#is_source ⇒ Boolean
Whether or not this is a Source step.
-
#logging ⇒ AWSCDK::CodeBuild::LoggingOptions?
Information about logs for CodeBuild projects.
-
#outputs ⇒ Array<AWSCDK::Pipelines::FileSetLocation>
Output FileSets.
-
#partial_build_spec ⇒ AWSCDK::CodeBuild::BuildSpec?
Additional configuration that can only be configured via BuildSpec.
-
#primary_output ⇒ AWSCDK::Pipelines::FileSet?
The primary FileSet produced by this Step.
-
#primary_output_directory(directory) ⇒ AWSCDK::Pipelines::FileSet
Configure the given output directory as primary output.
-
#project ⇒ AWSCDK::CodeBuild::IProject
CodeBuild Project generated for the pipeline.
-
#project_name ⇒ String?
Name for the generated CodeBuild project.
-
#role ⇒ AWSCDK::IAM::IRole?
Custom execution role to be used for the CodeBuild project.
-
#role_policy_statements ⇒ Array<AWSCDK::IAM::PolicyStatement>?
Policy statements to add to role used during the synth.
-
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
Which security group to associate with the script's project network interfaces.
-
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection?
Which subnets to use.
-
#timeout ⇒ AWSCDK::Duration?
The number of minutes after which AWS CodeBuild stops the build if it's not complete.
-
#to_string ⇒ String
Return a string representation of this Step.
-
#vpc ⇒ AWSCDK::EC2::IVPC?
The VPC where to execute the SimpleSynth.
Constructor Details
#initialize(id, props) ⇒ CodeBuildStep
Returns a new instance of CodeBuildStep.
21 22 23 24 25 26 |
# File 'pipelines/code_build_step.rb', line 21 def initialize(id, props) props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::CodeBuildStepProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuQ29kZUJ1aWxkU3RlcFByb3BzIn0=")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(id, props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
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 |
# File 'pipelines/code_build_step.rb', line 28 def self.jsii_overridable_methods { :consumed_stack_outputs => { kind: :property, name: "consumedStackOutputs", is_optional: false }, :dependencies => { kind: :property, name: "dependencies", is_optional: false }, :dependency_file_sets => { kind: :property, name: "dependencyFileSets", is_optional: false }, :id => { kind: :property, name: "id", is_optional: false }, :is_source => { kind: :property, name: "isSource", is_optional: false }, :primary_output => { kind: :property, name: "primaryOutput", is_optional: true }, :commands => { kind: :property, name: "commands", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :env_from_cfn_outputs => { kind: :property, name: "envFromCfnOutputs", is_optional: false }, :inputs => { kind: :property, name: "inputs", is_optional: false }, :install_commands => { kind: :property, name: "installCommands", is_optional: false }, :outputs => { kind: :property, name: "outputs", is_optional: false }, :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false }, :project => { kind: :property, name: "project", is_optional: false }, :action_role => { kind: :property, name: "actionRole", is_optional: true }, :build_environment => { kind: :property, name: "buildEnvironment", is_optional: true }, :cache => { kind: :property, name: "cache", is_optional: true }, :file_system_locations => { kind: :property, name: "fileSystemLocations", is_optional: true }, :logging => { kind: :property, name: "logging", is_optional: true }, :partial_build_spec => { kind: :property, name: "partialBuildSpec", is_optional: true }, :project_name => { kind: :property, name: "projectName", is_optional: true }, :role => { kind: :property, name: "role", is_optional: true }, :role_policy_statements => { kind: :property, name: "rolePolicyStatements", is_optional: true }, :security_groups => { kind: :property, name: "securityGroups", is_optional: true }, :subnet_selection => { kind: :property, name: "subnetSelection", is_optional: true }, :timeout => { kind: :property, name: "timeout", is_optional: true }, :vpc => { kind: :property, name: "vpc", is_optional: true }, :add_dependency_file_set => { kind: :method, name: "addDependencyFileSet", is_optional: false }, :add_step_dependency => { kind: :method, name: "addStepDependency", is_optional: false }, :configure_primary_output => { kind: :method, name: "configurePrimaryOutput", is_optional: false }, :discover_referenced_outputs => { kind: :method, name: "discoverReferencedOutputs", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :add_output_directory => { kind: :method, name: "addOutputDirectory", is_optional: false }, :primary_output_directory => { kind: :method, name: "primaryOutputDirectory", is_optional: false }, :exported_variable => { kind: :method, name: "exportedVariable", is_optional: false }, } end |
Instance Method Details
#action_role ⇒ AWSCDK::IAM::IRole?
Default: - A role is automatically created
Custom execution role to be used for the Code Build Action.
189 190 191 |
# File 'pipelines/code_build_step.rb', line 189 def action_role() jsii_get_property("actionRole") end |
#add_dependency_file_set(fs) ⇒ void
This method returns an undefined value.
Add an additional FileSet to the set of file sets required by this step.
This will lead to a dependency on the producer of that file set.
305 306 307 308 |
# File 'pipelines/code_build_step.rb', line 305 def add_dependency_file_set(fs) Jsii::Type.check_type(fs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuRmlsZVNldCJ9")), "fs") jsii_call_method("addDependencyFileSet", [fs]) end |
#add_output_directory(directory) ⇒ AWSCDK::Pipelines::FileSet
Add an additional output FileSet based on a directory.
After running the script, the contents of the given directory
will be exported as a FileSet. Use the FileSet as the
input to another step.
Multiple calls with the exact same directory name string (not normalized) will return the same FileSet.
360 361 362 363 |
# File 'pipelines/code_build_step.rb', line 360 def add_output_directory(directory) Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory") jsii_call_method("addOutputDirectory", [directory]) end |
#add_step_dependency(step) ⇒ void
This method returns an undefined value.
Add a dependency on another step.
314 315 316 317 |
# File 'pipelines/code_build_step.rb', line 314 def add_step_dependency(step) Jsii::Type.check_type(step, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuU3RlcCJ9")), "step") jsii_call_method("addStepDependency", [step]) end |
#build_environment ⇒ AWSCDK::CodeBuild::BuildEnvironment?
Default: - No value specified at construction time, use defaults
Build environment.
197 198 199 |
# File 'pipelines/code_build_step.rb', line 197 def build_environment() jsii_get_property("buildEnvironment") end |
#cache ⇒ AWSCDK::CodeBuild::Cache?
Default: - No cache
Caching strategy to use.
205 206 207 |
# File 'pipelines/code_build_step.rb', line 205 def cache() jsii_get_property("cache") end |
#commands ⇒ Array<String>
Commands to run.
118 119 120 |
# File 'pipelines/code_build_step.rb', line 118 def commands() jsii_get_property("commands") end |
#configure_primary_output(fs) ⇒ void
This method returns an undefined value.
Configure the given FileSet as the primary output of this step.
323 324 325 326 |
# File 'pipelines/code_build_step.rb', line 323 def configure_primary_output(fs) Jsii::Type.check_type(fs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuRmlsZVNldCJ9")), "fs") jsii_call_method("configurePrimaryOutput", [fs]) end |
#consumed_stack_outputs ⇒ Array<AWSCDK::Pipelines::StackOutputReference>
StackOutputReferences this step consumes.
71 72 73 |
# File 'pipelines/code_build_step.rb', line 71 def consumed_stack_outputs() jsii_get_property("consumedStackOutputs") end |
#dependencies ⇒ Array<AWSCDK::Pipelines::Step>
Return the steps this step depends on, based on the FileSets it requires.
78 79 80 |
# File 'pipelines/code_build_step.rb', line 78 def dependencies() jsii_get_property("dependencies") end |
#dependency_file_sets ⇒ Array<AWSCDK::Pipelines::FileSet>
The list of FileSets consumed by this Step.
85 86 87 |
# File 'pipelines/code_build_step.rb', line 85 def dependency_file_sets() jsii_get_property("dependencyFileSets") end |
#discover_referenced_outputs(structure) ⇒ void
This method returns an undefined value.
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
Should be called in the constructor of subclasses based on what the user passes in as construction properties. The format of the structure passed in here does not have to correspond exactly to what gets rendered into the engine, it just needs to contain the same data.
337 338 339 340 |
# File 'pipelines/code_build_step.rb', line 337 def discover_referenced_outputs(structure) Jsii::Type.check_type(structure, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "structure") jsii_call_method("discoverReferencedOutputs", [structure]) end |
#env ⇒ Hash{String => String}
Default: - No environment variables
Environment variables to set.
126 127 128 |
# File 'pipelines/code_build_step.rb', line 126 def env() jsii_get_property("env") end |
#env_from_cfn_outputs ⇒ Hash{String => AWSCDK::Pipelines::StackOutputReference}
Default: - No environment variables created from stack outputs
Set environment variables based on Stack Outputs.
134 135 136 |
# File 'pipelines/code_build_step.rb', line 134 def env_from_cfn_outputs() jsii_get_property("envFromCfnOutputs") end |
#exported_variable(variable_name) ⇒ String
Reference a CodePipeline variable defined by the CodeBuildStep.
The variable must be set in the shell of the CodeBuild step when
it finishes its post_build phase.
401 402 403 404 |
# File 'pipelines/code_build_step.rb', line 401 def exported_variable(variable_name) Jsii::Type.check_type(variable_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "variableName") jsii_call_method("exportedVariable", [variable_name]) end |
#file_system_locations ⇒ Array<AWSCDK::CodeBuild::IFileSystemLocation>?
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.
216 217 218 |
# File 'pipelines/code_build_step.rb', line 216 def file_system_locations() jsii_get_property("fileSystemLocations") end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The CodeBuild Project's principal.
172 173 174 |
# File 'pipelines/code_build_step.rb', line 172 def grant_principal() jsii_get_property("grantPrincipal") end |
#id ⇒ String
Identifier for this step.
92 93 94 |
# File 'pipelines/code_build_step.rb', line 92 def id() jsii_get_property("id") end |
#inputs ⇒ Array<AWSCDK::Pipelines::FileSetLocation>
Input FileSets.
A list of (FileSet, directory) pairs, which are a copy of the
input properties. This list should not be modified directly.
144 145 146 |
# File 'pipelines/code_build_step.rb', line 144 def inputs() jsii_get_property("inputs") end |
#install_commands ⇒ Array<String>
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.
155 156 157 |
# File 'pipelines/code_build_step.rb', line 155 def install_commands() jsii_get_property("installCommands") end |
#is_source ⇒ Boolean
Whether or not this is a Source step.
What it means to be a Source step depends on the engine.
101 102 103 |
# File 'pipelines/code_build_step.rb', line 101 def is_source() jsii_get_property("isSource") end |
#logging ⇒ AWSCDK::CodeBuild::LoggingOptions?
Default: - no log configuration is set
Information about logs for CodeBuild projects.
A CodeBuilde project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both.
226 227 228 |
# File 'pipelines/code_build_step.rb', line 226 def logging() jsii_get_property("logging") end |
#outputs ⇒ Array<AWSCDK::Pipelines::FileSetLocation>
Output FileSets.
A list of (FileSet, directory) pairs, which are a copy of the
input properties. This list should not be modified directly.
165 166 167 |
# File 'pipelines/code_build_step.rb', line 165 def outputs() jsii_get_property("outputs") end |
#partial_build_spec ⇒ AWSCDK::CodeBuild::BuildSpec?
Default: - Contains the exported variables
Additional configuration that can only be configured via BuildSpec.
Contains exported variables
236 237 238 |
# File 'pipelines/code_build_step.rb', line 236 def partial_build_spec() jsii_get_property("partialBuildSpec") end |
#primary_output ⇒ AWSCDK::Pipelines::FileSet?
The primary FileSet produced by this Step.
Not all steps produce an output FileSet--if they do
you can substitute the Step object for the FileSet object.
111 112 113 |
# File 'pipelines/code_build_step.rb', line 111 def primary_output() jsii_get_property("primaryOutput") end |
#primary_output_directory(directory) ⇒ AWSCDK::Pipelines::FileSet
Configure the given output directory as primary output.
If no primary output has been configured yet, this directory will become the primary output of this ShellStep, otherwise this method will throw if the given directory is different than the currently configured primary output directory.
374 375 376 377 |
# File 'pipelines/code_build_step.rb', line 374 def primary_output_directory(directory) Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory") jsii_call_method("primaryOutputDirectory", [directory]) end |
#project ⇒ AWSCDK::CodeBuild::IProject
CodeBuild Project generated for the pipeline.
Will only be available after the pipeline has been built.
181 182 183 |
# File 'pipelines/code_build_step.rb', line 181 def project() jsii_get_property("project") end |
#project_name ⇒ String?
Default: - No value specified at construction time, use defaults
Name for the generated CodeBuild project.
244 245 246 |
# File 'pipelines/code_build_step.rb', line 244 def project_name() jsii_get_property("projectName") end |
#role ⇒ AWSCDK::IAM::IRole?
Default: - No value specified at construction time, use defaults
Custom execution role to be used for the CodeBuild project.
252 253 254 |
# File 'pipelines/code_build_step.rb', line 252 def role() jsii_get_property("role") end |
#role_policy_statements ⇒ Array<AWSCDK::IAM::PolicyStatement>?
Default: - No value specified at construction time, use defaults
Policy statements to add to role used during the synth.
260 261 262 |
# File 'pipelines/code_build_step.rb', line 260 def role_policy_statements() jsii_get_property("rolePolicyStatements") end |
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
Default: - No value specified at construction time, use defaults
Which security group to associate with the script's project network interfaces.
268 269 270 |
# File 'pipelines/code_build_step.rb', line 268 def security_groups() jsii_get_property("securityGroups") end |
#subnet_selection ⇒ AWSCDK::EC2::SubnetSelection?
Default: - No value specified at construction time, use defaults
Which subnets to use.
276 277 278 |
# File 'pipelines/code_build_step.rb', line 276 def subnet_selection() jsii_get_property("subnetSelection") end |
#timeout ⇒ AWSCDK::Duration?
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.
287 288 289 |
# File 'pipelines/code_build_step.rb', line 287 def timeout() jsii_get_property("timeout") end |
#to_string ⇒ String
Return a string representation of this Step.
345 346 347 |
# File 'pipelines/code_build_step.rb', line 345 def to_string() jsii_call_method("toString", []) end |
#vpc ⇒ AWSCDK::EC2::IVPC?
Default: - No value specified at construction time, use defaults
The VPC where to execute the SimpleSynth.
295 296 297 |
# File 'pipelines/code_build_step.rb', line 295 def vpc() jsii_get_property("vpc") end |