Class: AWSCDK::Pipelines::ShellStepProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
pipelines/shell_step_props.rb

Overview

Construction properties for a ShellStep.

Direct Known Subclasses

CodeBuildStepProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commands:, additional_inputs: nil, env: nil, env_from_cfn_outputs: nil, input: nil, install_commands: nil, primary_output_directory: nil) ⇒ ShellStepProps

Returns a new instance of ShellStepProps.

Parameters:

  • commands (Array<String>)

    Commands to run.

  • additional_inputs (Hash{String => AWSCDK::Pipelines::IFileSetProducer}, nil) (defaults to: nil)

    Additional FileSets to put in other directories.

  • env (Hash{String => String}, nil) (defaults to: nil)

    Environment variables to set.

  • env_from_cfn_outputs (Hash{String => AWSCDK::CfnOutput}, nil) (defaults to: nil)

    Set environment variables based on Stack Outputs.

  • input (AWSCDK::Pipelines::IFileSetProducer, nil) (defaults to: nil)

    FileSet to run these scripts on.

  • install_commands (Array<String>, nil) (defaults to: nil)

    Installation commands to run before the regular commands.

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

    The directory that will contain the primary output fileset.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'pipelines/shell_step_props.rb', line 14

def initialize(commands:, additional_inputs: nil, env: nil, env_from_cfn_outputs: nil, input: nil, install_commands: nil, primary_output_directory: 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?
end

Instance Attribute Details

#additional_inputsHash{String => AWSCDK::Pipelines::IFileSetProducer}? (readonly)

Note:

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:

script = AWSCDK::Pipelines::ShellStep.new("MainScript", {
    commands: ["npm ci", "npm run build", "npx cdk synth"],
    input: AWSCDK::Pipelines::CodePipelineSource.git_hub("org/source1", "main"),
    additional_inputs: {
        "../siblingdir" => AWSCDK::Pipelines::CodePipelineSource.git_hub("org/source2", "main"),
    },
})

Returns:



57
58
59
# File 'pipelines/shell_step_props.rb', line 57

def additional_inputs
  @additional_inputs
end

#commandsArray<String> (readonly)

Commands to run.

Returns:

  • (Array<String>)


34
35
36
# File 'pipelines/shell_step_props.rb', line 34

def commands
  @commands
end

#envHash{String => String}? (readonly)

Note:

Default: - No environment variables

Environment variables to set.

Returns:

  • (Hash{String => String}, nil)


62
63
64
# File 'pipelines/shell_step_props.rb', line 62

def env
  @env
end

#env_from_cfn_outputsHash{String => AWSCDK::CfnOutput}? (readonly)

Note:

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.

Returns:



72
73
74
# File 'pipelines/shell_step_props.rb', line 72

def env_from_cfn_outputs
  @env_from_cfn_outputs
end

#inputAWSCDK::Pipelines::IFileSetProducer? (readonly)

Note:

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.



81
82
83
# File 'pipelines/shell_step_props.rb', line 81

def input
  @input
end

#install_commandsArray<String>? (readonly)

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>, nil)


89
90
91
# File 'pipelines/shell_step_props.rb', line 89

def install_commands
  @install_commands
end

#primary_output_directoryString? (readonly)

Note:

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.

Returns:

  • (String, nil)


97
98
99
# File 'pipelines/shell_step_props.rb', line 97

def primary_output_directory
  @primary_output_directory
end

Class Method Details

.jsii_propertiesObject



99
100
101
102
103
104
105
106
107
108
109
# File 'pipelines/shell_step_props.rb', line 99

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

Instance Method Details

#to_jsiiObject



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'pipelines/shell_step_props.rb', line 111

def to_jsii
  result = {}
  result.merge!({
    "commands" => @commands,
    "additionalInputs" => @additional_inputs,
    "env" => @env,
    "envFromCfnOutputs" => @env_from_cfn_outputs,
    "input" => @input,
    "installCommands" => @install_commands,
    "primaryOutputDirectory" => @primary_output_directory,
  })
  result.compact
end