# Step

A generic Step which can be added to a Pipeline.

Steps can be used to add Sources, Build Actions and Validations
to your pipeline.

This class is abstract. See specific subclasses of Step for
useful steps to add to your Pipeline

Extends: Step
Implements: IFileSetProducer
Superclass of: CodeBuildStep, CodePipelineSource, ConfirmPermissionsBroadening, ManualApprovalStep, ShellStep

- Source: [`pipelines/lib/blueprint/step.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/pipelines/lib/blueprint/step.ts#L17)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

```ts
class MyJenkinsStep
  extends pipelines.Step
  implements pipelines.ICodePipelineActionFactory
{
  constructor(
    private readonly provider: cpactions.JenkinsProvider,
    private readonly input: pipelines.FileSet
  ) {
    super('MyJenkinsStep');

    // This is necessary if your step accepts parameters, like environment variables,
    // that may contain outputs from other steps. It doesn't matter what the
    // structure is, as long as it contains the values that may contain outputs.
    this.discoverReferencedOutputs({
      env: {
        /* ... */
      },
    });
  }

  public produceAction(
    stage: codepipeline.IStage,
    options: pipelines.ProduceActionOptions
  ): pipelines.CodePipelineActionFactoryResult {
    // This is where you control what type of Action gets added to the
    // CodePipeline
    stage.addAction(
      new cpactions.JenkinsAction({
        // Copy 'actionName' and 'runOrder' from the options
        actionName: options.actionName,
        runOrder: options.runOrder,

        // Jenkins-specific configuration
        type: cpactions.JenkinsActionType.TEST,
        jenkinsProvider: this.provider,
        projectName: 'MyJenkinsProject',

        // Translate the FileSet into a codepipeline.Artifact
        inputs: [options.artifacts.toCodePipeline(this.input)],
      })
    );

    return { runOrdersConsumed: 1 };
  }
}
```

## Initializer

```ts
new Step(id: string)
```

## Properties

- `consumedStackOutputs`: [StackOutputReference](/cdk/api/v2/docs/aws-cdk-lib.pipelines.StackOutputReference.html)[] — StackOutputReferences this step consumes.

- `dependencies`: [Step](/cdk/api/v2/docs/aws-cdk-lib.pipelines.Step.html)[] — Return the steps this step depends on, based on the FileSets it requires.

- `dependencyFileSets`: [FileSet](/cdk/api/v2/docs/aws-cdk-lib.pipelines.FileSet.html)[] — The list of FileSets consumed by this Step.

- `id`: string — Identifier for this step.

- `isSource`: boolean — Whether or not this is a Source step.

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

- `primaryOutput`: [FileSet](/cdk/api/v2/docs/aws-cdk-lib.pipelines.FileSet.html) — 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

- `addStepDependency(step: Step): void` — Add a dependency on another step.

- `sequence(steps: Step[]): Step[]` (static) — Define a sequence of steps to be executed in order.

  If you need more fine-grained step ordering, use the `addStepDependency()`
  API. For example, if you want `secondStep` to occur after `firstStep`, call
  `secondStep.addStepDependency(firstStep)`.

- `toString(): string` — Return a string representation of this Step.
