Class Step
A generic Step which can be added to a Pipeline.
Inheritance
Implements
Namespace: Amazon.CDK.Pipelines
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class Step : DeputyBase, IFileSetProducer
Syntax (vb)
Public MustInherit Class [Step] Inherits DeputyBase Implements IFileSetProducer
Remarks
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
ExampleMetadata: infused
Examples
class MyJenkinsStep : Step, ICodePipelineActionFactory
{
public MyJenkinsStep(JenkinsProvider provider, FileSet input) : base("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.
DiscoverReferencedOutputs(new Dictionary<string, IDictionary<string, object>> {
{ "env", new Struct { } }
});
}
public CodePipelineActionFactoryResult ProduceAction(IStage stage, ProduceActionOptions options)
{
// This is where you control what type of Action gets added to the
// CodePipeline
stage.AddAction(
new JenkinsAction(new JenkinsActionProps {
// Copy 'actionName' and 'runOrder' from the options
ActionName = options.ActionName,
RunOrder = options.RunOrder,
// Jenkins-specific configuration
Type = JenkinsActionType.TEST,
JenkinsProvider = Provider,
ProjectName = "MyJenkinsProject",
// Translate the FileSet into a codepipeline.Artifact
Inputs = new [] { options.Artifacts.ToCodePipeline(Input) }
}));
return new CodePipelineActionFactoryResult { RunOrdersConsumed = 1 };
}
}
Synopsis
Constructors
| Step(string) | A generic Step which can be added to a Pipeline. |
Properties
| ConsumedStackOutputs | StackOutputReferences this step consumes. |
| Dependencies | Return the steps this step depends on, based on the FileSets it requires. |
| DependencyFileSets | The list of FileSets consumed by this Step. |
| Id | Identifier for this step. |
| IsSource | Whether or not this is a Source step. |
| PrimaryOutput | The primary FileSet produced by this Step. |
Methods
| AddDependencyFileSet(FileSet) | Add an additional FileSet to the set of file sets required by this step. |
| AddStepDependency(Step) | Add a dependency on another step. |
| ConfigurePrimaryOutput(FileSet) | Configure the given FileSet as the primary output of this step. |
| DiscoverReferencedOutputs(object) | Crawl the given structure for references to StepOutputs and add dependencies on all steps found. |
| Sequence(Step[]) | Define a sequence of steps to be executed in order. |
| ToString() | Return a string representation of this Step. |
Constructors
Step(string)
A generic Step which can be added to a Pipeline.
protected Step(string id)
Parameters
- id string
Identifier for this step.
Remarks
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
ExampleMetadata: infused
Properties
ConsumedStackOutputs
StackOutputReferences this step consumes.
public virtual StackOutputReference[] ConsumedStackOutputs { get; }
Property Value
Remarks
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
ExampleMetadata: infused
Dependencies
Return the steps this step depends on, based on the FileSets it requires.
public virtual Step[] Dependencies { get; }
Property Value
Step[]
Remarks
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
ExampleMetadata: infused
DependencyFileSets
The list of FileSets consumed by this Step.
public virtual FileSet[] DependencyFileSets { get; }
Property Value
FileSet[]
Remarks
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
ExampleMetadata: infused
Id
Identifier for this step.
public virtual string Id { get; }
Property Value
Remarks
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
ExampleMetadata: infused
IsSource
Whether or not this is a Source step.
public virtual bool IsSource { get; }
Property Value
Remarks
What it means to be a Source step depends on the engine.
PrimaryOutput
The primary FileSet produced by this Step.
public virtual FileSet? PrimaryOutput { get; }
Property Value
Remarks
Not all steps produce an output FileSet--if they do
you can substitute the Step object for the FileSet object.
Methods
AddDependencyFileSet(FileSet)
Add an additional FileSet to the set of file sets required by this step.
protected virtual void AddDependencyFileSet(FileSet fs)
Parameters
- fs FileSet
Remarks
This will lead to a dependency on the producer of that file set.
AddStepDependency(Step)
Add a dependency on another step.
public virtual void AddStepDependency(Step step)
Parameters
- step Step
Remarks
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
ExampleMetadata: infused
ConfigurePrimaryOutput(FileSet)
Configure the given FileSet as the primary output of this step.
protected virtual void ConfigurePrimaryOutput(FileSet fs)
Parameters
- fs FileSet
Remarks
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
ExampleMetadata: infused
DiscoverReferencedOutputs(object)
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
protected virtual void DiscoverReferencedOutputs(object structure)
Parameters
- structure object
Remarks
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.
Sequence(Step[])
Define a sequence of steps to be executed in order.
public static Step[] Sequence(Step[] steps)
Parameters
- steps Step[]
Returns
Step[]
Remarks
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()
Return a string representation of this Step.
public override string ToString()
Returns
Remarks
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
ExampleMetadata: infused