Class ShellStep
Run shell script commands in the pipeline.
Implements
Inherited Members
Namespace: Amazon.CDK.Pipelines
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ShellStep : Step, IFileSetProducer
Syntax (vb)
Public Class ShellStep
Inherits
Step Implements IFileSetProducer
Remarks
This is a generic step designed to be deployment engine agnostic.
ExampleMetadata: infused
Examples
// Modern API
var modernPipeline = new CodePipeline(this, "Pipeline", new CodePipelineProps {
SelfMutation = false,
Synth = new ShellStep("Synth", new ShellStepProps {
Input = CodePipelineSource.Connection("my-org/my-app", "main", new ConnectionSourceOptions {
ConnectionArn = "arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"
}),
Commands = new [] { "npm ci", "npm run build", "npx cdk synth" }
})
});
// Original API
var cloudAssemblyArtifact = new Artifact();
var originalPipeline = new CdkPipeline(this, "Pipeline", new CdkPipelineProps {
SelfMutating = false,
CloudAssemblyArtifact = cloudAssemblyArtifact
});
Synopsis
Constructors
ShellStep(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ShellStep(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
ShellStep(String, IShellStepProps) |
Properties
Commands | Commands to run. |
ConsumedStackOutputs | StackOutputReferences this step consumes. |
Env | Environment variables to set. |
EnvFromCfnOutputs | Set environment variables based on Stack Outputs. |
Inputs | Input FileSets. |
InstallCommands | Installation commands to run before the regular commands. |
Outputs | Output FileSets. |
Methods
AddOutputDirectory(String) | Add an additional output FileSet based on a directory. |
PrimaryOutputDirectory(String) | Configure the given output directory as primary output. |
Constructors
ShellStep(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ShellStep(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ShellStep(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ShellStep(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
ShellStep(String, IShellStepProps)
public ShellStep(string id, IShellStepProps props)
Parameters
- id System.String
Identifier for this step.
- props IShellStepProps
Identifier for this step.
Properties
Commands
Commands to run.
public virtual string[] Commands { get; }
Property Value
System.String[]
ConsumedStackOutputs
StackOutputReferences this step consumes.
public override StackOutputReference[] ConsumedStackOutputs { get; }
Property Value
Overrides
Env
Environment variables to set.
public virtual IDictionary<string, string> Env { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Default: - No environment variables
EnvFromCfnOutputs
Set environment variables based on Stack Outputs.
public virtual IDictionary<string, StackOutputReference> EnvFromCfnOutputs { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, StackOutputReference>
Remarks
Default: - No environment variables created from stack outputs
Inputs
Input FileSets.
public virtual IFileSetLocation[] Inputs { get; }
Property Value
Remarks
A list of (FileSet, directory)
pairs, which are a copy of the
input properties. This list should not be modified directly.
InstallCommands
Installation commands to run before the regular commands.
public virtual string[] InstallCommands { get; }
Property Value
System.String[]
Remarks
For deployment engines that support it, install commands will be classified
differently in the job history from the regular commands
.
Default: - No installation commands
Outputs
Output FileSets.
public virtual IFileSetLocation[] Outputs { get; }
Property Value
Remarks
A list of (FileSet, directory)
pairs, which are a copy of the
input properties. This list should not be modified directly.
Methods
AddOutputDirectory(String)
Add an additional output FileSet based on a directory.
public virtual FileSet AddOutputDirectory(string directory)
Parameters
- directory System.String
Returns
Remarks
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.
PrimaryOutputDirectory(String)
Configure the given output directory as primary output.
public virtual FileSet PrimaryOutputDirectory(string directory)
Parameters
- directory System.String
Returns
Remarks
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.