aws-cdk-lib.pipelines.ShellStep

class ShellStep

LanguageType name
.NETAmazon.CDK.Pipelines.ShellStep
Gogithub.com/aws/aws-cdk-go/awscdk/v2/pipelines#ShellStep
Javasoftware.amazon.awscdk.pipelines.ShellStep
Pythonaws_cdk.pipelines.ShellStep
TypeScript (source)aws-cdk-lib » pipelines » ShellStep

Implements IFileSetProducer

Extends Step

Run shell script commands in the pipeline.

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

Example

declare const codePipeline: codepipeline.Pipeline;

const sourceArtifact = new codepipeline.Artifact('MySourceArtifact');

const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
  codePipeline: codePipeline,
  synth: new pipelines.ShellStep('Synth', {
    input: pipelines.CodePipelineFileSet.fromArtifact(sourceArtifact),
    commands: ['npm ci','npm run build','npx cdk synth'],
  }),
});

Initializer

new ShellStep(id: string, props: ShellStepProps)

Parameters

  • id string — Identifier for this step.
  • props ShellStepProps

Properties

NameTypeDescription
commandsstring[]Commands to run.
consumedStackOutputsStackOutputReference[]StackOutputReferences this step consumes.
dependenciesStep[]Return the steps this step depends on, based on the FileSets it requires.
dependencyFileSetsFileSet[]The list of FileSets consumed by this Step.
env{ [string]: string }Environment variables to set.
envFromCfnOutputs{ [string]: StackOutputReference }Set environment variables based on Stack Outputs.
idstringIdentifier for this step.
inputsFileSetLocation[]Input FileSets.
installCommandsstring[]Installation commands to run before the regular commands.
isSourcebooleanWhether or not this is a Source step.
outputsFileSetLocation[]Output FileSets.
primaryOutput?FileSetThe primary FileSet produced by this Step.

commands

Type: string[]

Commands to run.


consumedStackOutputs

Type: StackOutputReference[]

StackOutputReferences this step consumes.


dependencies

Type: Step[]

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


dependencyFileSets

Type: FileSet[]

The list of FileSets consumed by this Step.


env

Type: { [string]: string }

Environment variables to set.


envFromCfnOutputs

Type: { [string]: StackOutputReference }

Set environment variables based on Stack Outputs.


id

Type: string

Identifier for this step.


inputs

Type: FileSetLocation[]

Input FileSets.

A list of (FileSet, directory) pairs, which are a copy of the input properties. This list should not be modified directly.


installCommands

Type: string[]

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.


isSource

Type: boolean

Whether or not this is a Source step.

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


outputs

Type: FileSetLocation[]

Output FileSets.

A list of (FileSet, directory) pairs, which are a copy of the input properties. This list should not be modified directly.


primaryOutput?

Type: FileSet (optional)

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.

Methods

NameDescription
addOutputDirectory(directory)Add an additional output FileSet based on a directory.
addStepDependency(step)Add a dependency on another step.
primaryOutputDirectory(directory)Configure the given output directory as primary output.
toString()Return a string representation of this Step.

addOutputDirectory(directory)

public addOutputDirectory(directory: string): FileSet

Parameters

  • directory string

Returns

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


addStepDependency(step)

public addStepDependency(step: Step): void

Parameters

  • step Step

Add a dependency on another step.


primaryOutputDirectory(directory)

public primaryOutputDirectory(directory: string): FileSet

Parameters

  • directory string

Returns

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


toString()

public toString(): string

Returns

  • string

Return a string representation of this Step.