Class ShellStep

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.pipelines.Step
software.amazon.awscdk.pipelines.ShellStep
All Implemented Interfaces:
IFileSetProducer, software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
CodeBuildStep

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:15.297Z") @Stability(Stable) public class ShellStep extends Step
Run shell script commands in the pipeline.

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

Example:

 // Modern API
 CodePipeline modernPipeline = CodePipeline.Builder.create(this, "Pipeline")
         .selfMutation(false)
         .synth(ShellStep.Builder.create("Synth")
                 .input(CodePipelineSource.connection("my-org/my-app", "main", ConnectionSourceOptions.builder()
                         .connectionArn("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41")
                         .build()))
                 .commands(List.of("npm ci", "npm run build", "npx cdk synth"))
                 .build())
         .build();
 // Original API
 Artifact cloudAssemblyArtifact = new Artifact();
 CdkPipeline originalPipeline = new CdkPipeline(this, "Pipeline", new CdkPipelineProps()
         .selfMutating(false)
         .cloudAssemblyArtifact(cloudAssemblyArtifact)
         );
 
  • Constructor Details

    • ShellStep

      protected ShellStep(software.amazon.jsii.JsiiObjectRef objRef)
    • ShellStep

      protected ShellStep(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ShellStep

      @Stability(Stable) public ShellStep(@NotNull String id, @NotNull ShellStepProps props)
      Parameters:
      id - Identifier for this step. This parameter is required.
      props - This parameter is required.
  • Method Details

    • addOutputDirectory

      @Stability(Stable) @NotNull public FileSet addOutputDirectory(@NotNull String directory)
      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.

      Parameters:
      directory - This parameter is required.
    • primaryOutputDirectory

      @Stability(Stable) @NotNull public FileSet primaryOutputDirectory(@NotNull String directory)
      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.

      Parameters:
      directory - This parameter is required.
    • getCommands

      @Stability(Stable) @NotNull public List<String> getCommands()
      Commands to run.
    • getConsumedStackOutputs

      @Stability(Stable) @NotNull public List<StackOutputReference> getConsumedStackOutputs()
      StackOutputReferences this step consumes.
      Overrides:
      getConsumedStackOutputs in class Step
    • getEnv

      @Stability(Stable) @NotNull public Map<String,String> getEnv()
      Environment variables to set.

      Default: - No environment variables

    • getEnvFromCfnOutputs

      @Stability(Stable) @NotNull public Map<String,StackOutputReference> getEnvFromCfnOutputs()
      Set environment variables based on Stack Outputs.

      Default: - No environment variables created from stack outputs

    • getInputs

      @Stability(Stable) @NotNull public List<FileSetLocation> getInputs()
      Input FileSets.

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

    • getInstallCommands

      @Stability(Stable) @NotNull public List<String> getInstallCommands()
      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

    • getOutputs

      @Stability(Stable) @NotNull public List<FileSetLocation> getOutputs()
      Output FileSets.

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