Class: AWSCDK::Pipelines::ShellStep

Inherits:
Step
  • Object
show all
Defined in:
pipelines/shell_step.rb

Overview

Run shell script commands in the pipeline.

This is a generic step designed to be deployment engine agnostic.

Direct Known Subclasses

CodeBuildStep

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, props) ⇒ ShellStep

Returns a new instance of ShellStep.

Parameters:



13
14
15
16
17
18
# File 'pipelines/shell_step.rb', line 13

def initialize(id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::ShellStepProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuU2hlbGxTdGVwUHJvcHMifQ==")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(id, props)
end

Class Method Details

.jsii_overridable_methodsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'pipelines/shell_step.rb', line 20

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 },
    :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 },
  }
end

Instance Method Details

#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.

Parameters:



151
152
153
154
# File 'pipelines/shell_step.rb', line 151

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.

Parameters:

  • directory (String)

Returns:



206
207
208
209
# File 'pipelines/shell_step.rb', line 206

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.

Parameters:



160
161
162
163
# File 'pipelines/shell_step.rb', line 160

def add_step_dependency(step)
  Jsii::Type.check_type(step, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuU3RlcCJ9")), "step")
  jsii_call_method("addStepDependency", [step])
end

#commandsArray<String>

Commands to run.

Returns:

  • (Array<String>)


94
95
96
# File 'pipelines/shell_step.rb', line 94

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.

Parameters:



169
170
171
172
# File 'pipelines/shell_step.rb', line 169

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_outputsArray<AWSCDK::Pipelines::StackOutputReference>

StackOutputReferences this step consumes.



47
48
49
# File 'pipelines/shell_step.rb', line 47

def consumed_stack_outputs()
  jsii_get_property("consumedStackOutputs")
end

#dependenciesArray<AWSCDK::Pipelines::Step>

Return the steps this step depends on, based on the FileSets it requires.

Returns:



54
55
56
# File 'pipelines/shell_step.rb', line 54

def dependencies()
  jsii_get_property("dependencies")
end

#dependency_file_setsArray<AWSCDK::Pipelines::FileSet>

The list of FileSets consumed by this Step.

Returns:



61
62
63
# File 'pipelines/shell_step.rb', line 61

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.

Parameters:

  • structure (Object)


183
184
185
186
# File 'pipelines/shell_step.rb', line 183

def discover_referenced_outputs(structure)
  Jsii::Type.check_type(structure, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "structure")
  jsii_call_method("discoverReferencedOutputs", [structure])
end

#envHash{String => String}

Note:

Default: - No environment variables

Environment variables to set.

Returns:

  • (Hash{String => String})


102
103
104
# File 'pipelines/shell_step.rb', line 102

def env()
  jsii_get_property("env")
end

#env_from_cfn_outputsHash{String => AWSCDK::Pipelines::StackOutputReference}

Note:

Default: - No environment variables created from stack outputs

Set environment variables based on Stack Outputs.

Returns:



110
111
112
# File 'pipelines/shell_step.rb', line 110

def env_from_cfn_outputs()
  jsii_get_property("envFromCfnOutputs")
end

#idString

Identifier for this step.

Returns:

  • (String)


68
69
70
# File 'pipelines/shell_step.rb', line 68

def id()
  jsii_get_property("id")
end

#inputsArray<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.



120
121
122
# File 'pipelines/shell_step.rb', line 120

def inputs()
  jsii_get_property("inputs")
end

#install_commandsArray<String>

Note:

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.

Returns:

  • (Array<String>)


131
132
133
# File 'pipelines/shell_step.rb', line 131

def install_commands()
  jsii_get_property("installCommands")
end

#is_sourceBoolean

Whether or not this is a Source step.

What it means to be a Source step depends on the engine.

Returns:

  • (Boolean)


77
78
79
# File 'pipelines/shell_step.rb', line 77

def is_source()
  jsii_get_property("isSource")
end

#outputsArray<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.



141
142
143
# File 'pipelines/shell_step.rb', line 141

def outputs()
  jsii_get_property("outputs")
end

#primary_outputAWSCDK::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.

Returns:



87
88
89
# File 'pipelines/shell_step.rb', line 87

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.

Parameters:

  • directory (String)

Returns:



220
221
222
223
# File 'pipelines/shell_step.rb', line 220

def primary_output_directory(directory)
  Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory")
  jsii_call_method("primaryOutputDirectory", [directory])
end

#to_stringString

Return a string representation of this Step.

Returns:

  • (String)


191
192
193
# File 'pipelines/shell_step.rb', line 191

def to_string()
  jsii_call_method("toString", [])
end