class Step
Language | Type name |
---|---|
![]() | Amazon.CDK.Pipelines.Step |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/pipelines#Step |
![]() | software.amazon.awscdk.pipelines.Step |
![]() | aws_cdk.pipelines.Step |
![]() | aws-cdk-lib » pipelines » Step |
Implements
IFile
Implemented by
Code
, Confirm
, Manual
, Shell
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
Example
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
new Step(id: string)
Parameters
- id
string
— Identifier for this step.
Properties
Name | Type | Description |
---|---|---|
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. |
id | string | Identifier for this step. |
is | boolean | Whether or not this is a Source step. |
primary | File | The primary FileSet produced by this Step. |
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.
id
Type:
string
Identifier for this step.
isSource
Type:
boolean
Whether or not this is a Source step.
What it means to be a Source step depends on the engine.
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 a dependency on another step. |
to | Return a string representation of this Step. |
protected add | Add an additional FileSet to the set of file sets required by this step. |
protected configure | Configure the given FileSet as the primary output of this step. |
protected discover | Crawl the given structure for references to StepOutputs and add dependencies on all steps found. |
static sequence(steps) | Define a sequence of steps to be executed in order. |
addStepDependency(step)
public addStepDependency(step: Step): void
Parameters
- step
Step
Add a dependency on another step.
toString()
public toString(): string
Returns
string
Return a string representation of this Step.
protected addDependencyFileSet(fs)
protected addDependencyFileSet(fs: FileSet): void
Parameters
- fs
File
Set
Add an additional FileSet to the set of file sets required by this step.
This will lead to a dependency on the producer of that file set.
protected configurePrimaryOutput(fs)
protected configurePrimaryOutput(fs: FileSet): void
Parameters
- fs
File
Set
Configure the given FileSet as the primary output of this step.
protected discoverReferencedOutputs(structure)
protected discoverReferencedOutputs(structure: any): void
Parameters
- structure
any
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
Should be called in the constructor of subclasses based on what the user passes in as construction properties. The format of the structure passed in here does not have to correspond exactly to what gets rendered into the engine, it just needs to contain the same data.
static sequence(steps)
public static sequence(steps: Step[]): Step[]
Parameters
- steps
Step
[]
Returns
Step
[]
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)
.