ShellStepProps

class aws_cdk.pipelines.ShellStepProps(*, commands, additional_inputs=None, env=None, env_from_cfn_outputs=None, input=None, install_commands=None, primary_output_directory=None)

Bases: object

Construction properties for a ShellStep.

Parameters
  • commands (Sequence[str]) – Commands to run.

  • additional_inputs (Optional[Mapping[str, IFileSetProducer]]) – 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:: const script = new pipelines.ShellStep(‘MainScript’, { commands: [‘npm ci’,’npm run build’,’npx cdk synth’], input: pipelines.CodePipelineSource.gitHub(‘org/source1’, ‘main’), additionalInputs: { ‘../siblingdir’: pipelines.CodePipelineSource.gitHub(‘org/source2’, ‘main’), } }); Default: - No additional inputs

  • env (Optional[Mapping[str, str]]) – Environment variables to set. Default: - No environment variables

  • env_from_cfn_outputs (Optional[Mapping[str, CfnOutput]]) – Set environment variables based on Stack Outputs. ``ShellStep``s following stack or stage deployments may access the ``CfnOutput``s of those stacks to get access to –for example–automatically generated resource names or endpoint URLs. Default: - No environment variables created from stack outputs

  • input (Optional[IFileSetProducer]) – FileSet to run these scripts on. The files in the FileSet will be placed in the working directory when the script is executed. Use additionalInputs to download file sets to other directories as well. Default: - No input specified

  • install_commands (Optional[Sequence[str]]) – 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. Default: - No installation commands

  • primary_output_directory (Optional[str]) – 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. Default: - No primary output

ExampleMetadata

infused

Example:

# Modern API
modern_pipeline = pipelines.CodePipeline(self, "Pipeline",
    self_mutation=False,
    synth=pipelines.ShellStep("Synth",
        input=pipelines.CodePipelineSource.connection("my-org/my-app", "main",
            connection_arn="arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"
        ),
        commands=["npm ci", "npm run build", "npx cdk synth"
        ]
    )
)

# Original API
cloud_assembly_artifact = codepipeline.Artifact()
original_pipeline = pipelines.CdkPipeline(self, "Pipeline",
    self_mutating=False,
    cloud_assembly_artifact=cloud_assembly_artifact
)

Attributes

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 = pipelines.ShellStep("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")
    }
)
Default
  • No additional inputs

Return type

Optional[Mapping[str, IFileSetProducer]]

commands

Commands to run.

Return type

List[str]

env

Environment variables to set.

Default
  • No environment variables

Return type

Optional[Mapping[str, str]]

env_from_cfn_outputs

Set environment variables based on Stack Outputs.

``ShellStep``s following stack or stage deployments may access the ``CfnOutput``s of those stacks to get access to –for example–automatically generated resource names or endpoint URLs.

Default
  • No environment variables created from stack outputs

Return type

Optional[Mapping[str, CfnOutput]]

input

FileSet to run these scripts on.

The files in the FileSet will be placed in the working directory when the script is executed. Use additionalInputs to download file sets to other directories as well.

Default
  • No input specified

Return type

Optional[IFileSetProducer]

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

Default
  • No installation commands

Return type

Optional[List[str]]

primary_output_directory

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.

Default
  • No primary output

Return type

Optional[str]