class ShellStep
Language | Type name |
---|---|
.NET | Amazon.CDK.Pipelines.ShellStep |
Go | github.com/aws/aws-cdk-go/awscdk/v2/pipelines#ShellStep |
Java | software.amazon.awscdk.pipelines.ShellStep |
Python | aws_cdk.pipelines.ShellStep |
TypeScript (source) | aws-cdk-lib » pipelines » ShellStep |
Implements
IFile
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
Shell
Step Props
Properties
Name | Type | Description |
---|---|---|
commands | string[] | Commands to run. |
consumed | Stack [] | StackOutputReferences this step consumes. |
dependencies | Step [] | Return the steps this step depends on, based on the FileSets it requires. |
dependency | File [] | The list of FileSets consumed by this Step. |
env | { [string]: string } | Environment variables to set. |
env | { [string]: Stack } | Set environment variables based on Stack Outputs. |
id | string | Identifier for this step. |
inputs | File [] | Input FileSets. |
install | string[] | Installation commands to run before the regular commands. |
is | boolean | Whether or not this is a Source step. |
outputs | File [] | Output FileSets. |
primary | File | The primary FileSet produced by this Step. |
commands
Type:
string[]
Commands to run.
consumedStackOutputs
Type:
Stack
[]
StackOutputReferences this step consumes.
dependencies
Type:
Step
[]
Return the steps this step depends on, based on the FileSets it requires.
dependencyFileSets
Type:
File
[]
The list of FileSets consumed by this Step.
env
Type:
{ [string]: string }
Environment variables to set.
envFromCfnOutputs
Type:
{ [string]:
Stack
}
Set environment variables based on Stack Outputs.
id
Type:
string
Identifier for this step.
inputs
Type:
File
[]
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:
File
[]
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:
File
(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
Name | Description |
---|---|
add | Add an additional output FileSet based on a directory. |
add | Add a dependency on another step. |
primary | Configure the given output directory as primary output. |
to | Return a string representation of this Step. |
addOutputDirectory(directory)
public addOutputDirectory(directory: string): FileSet
Parameters
- directory
string
Returns
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
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.