class CommandsAction
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodePipeline.Actions.CommandsAction |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#CommandsAction |
![]() | software.amazon.awscdk.services.codepipeline.actions.CommandsAction |
![]() | aws_cdk.aws_codepipeline_actions.CommandsAction |
![]() | aws-cdk-lib » aws_codepipeline_actions » CommandsAction |
Implements
IAction
Extends
Action
CodePipeline compute action that uses AWS Commands.
Example
declare const sourceArtifact: codepipeline.Artifact;
declare const outputArtifact: codepipeline.Artifact;
const commandsAction = new codepipeline_actions.CommandsAction({
actionName: 'Commands',
commands: [
'export MY_OUTPUT=my-key',
],
input: sourceArtifact,
output: outputArtifact,
outputVariables: ['MY_OUTPUT', 'CODEBUILD_BUILD_ID'], // CODEBUILD_BUILD_ID is a variable defined by CodeBuild
});
// Deploy action
const deployAction = new codepipeline_actions.S3DeployAction({
actionName: 'DeployAction',
extract: true,
input: outputArtifact,
bucket: new s3.Bucket(this, 'DeployBucket'),
objectKey: commandsAction.variable('MY_OUTPUT'), // the variable emitted by the Commands action
});
Initializer
new CommandsAction(props: CommandsActionProps)
Parameters
- props
Commands
Action Props
Properties
Name | Type | Description |
---|---|---|
action | Action | The simple properties of the Action, like its Owner, name, etc. |
actionProperties
Type:
Action
The simple properties of the Action, like its Owner, name, etc.
Note that this accessor will be called before the bind
callback.
Methods
Name | Description |
---|---|
bind(scope, stage, options) | The callback invoked when this Action is added to a Pipeline. |
on | Creates an Event that will be triggered whenever the state of this Action changes. |
variable(variableName) | Reference a CodePipeline variable exported in the Commands action. |
protected bound(scope, stage, options) | This is a renamed version of the IAction.bind method. |
bind(scope, stage, options)
public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct
- stage
IStage
- options
Action
Bind Options
Returns
The callback invoked when this Action is added to a Pipeline.
onStateChange(name, target?, options?)
public onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule
Parameters
- name
string
- target
IRule
Target - options
Rule
Props
Returns
Creates an Event that will be triggered whenever the state of this Action changes.
variable(variableName)
public variable(variableName: string): string
Parameters
- variableName
string
— the name of the variable exported byoutputVariables
.
Returns
string
Reference a CodePipeline variable exported in the Commands action.
See also: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
protected bound(scope, stage, options)
protected bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct
- stage
IStage
- options
Action
Bind Options
Returns
This is a renamed version of the IAction.bind
method.