Skip to content
v2.274.0

CommandsActionProps Struct ​

Construction properties of the CommandsAction.

Example ​

ts
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
});

Properties ​

actionNamestringaction_namestractionNameStringActionNamestringActionName*stringrequired#
The physical, human-readable name of the Action.

Note that Action names must be unique within a single Stage.

commandsstring[]commandstyping.List[str]commandsList<String>Commandsstring[]Commands*[]*stringrequired#
Shell commands for the Commands action to run.

All formats are supported except multi-line formats.

The length of the commands array must be between 1 and 50.

extraInputsoptionalArtifact[]extra_inputsoptionaltyping.List[Artifact]extraInputsoptionalList<Artifact>ExtraInputsoptionalArtifact[]ExtraInputsoptional*[]Artifact#
The list of additional input artifacts for this action.

Default: no extra inputs

inputArtifactinputArtifactinputArtifactInputArtifactInputArtifactrequired#
The source to use as input for this action.
outputoptionalArtifactoutputoptionalArtifactoutputoptionalArtifactOutputoptionalArtifactOutputoptionalArtifact#
The output artifact for this action.

Default: no output artifact

You can filter files that you want to export as the output artifact for the action.

example
ts
new codepipeline.Artifact('CommandsArtifact', ['my-dir/**']);
outputVariablesoptionalstring[]output_variablesoptionaltyping.List[str]outputVariablesoptionalList<String>OutputVariablesoptionalstring[]OutputVariablesoptional*[]*string#
The names of the variables in your environment that you want to export.

Default: No output variables are exported

These variables can be referenced in other actions by using the variable method of this class.

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
The Role in which context's this Action will be executing in.

Default: a new Role will be generated

notes

The Pipeline's Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your IAction.bind method in the ActionBindOptions.role property.

runOrderoptionalnumberrun_orderoptionalint | floatrunOrderoptionalNumberRunOrderoptionaldoubleRunOrderoptional*float64= 1#
The runOrder property for this Action.

RunOrder determines the relative order in which multiple Actions in the same Stage execute.

variablesNamespaceoptionalstringvariables_namespaceoptionalstrvariablesNamespaceoptionalStringVariablesNamespaceoptionalstringVariablesNamespaceoptional*string#
The name of the namespace to use for variables emitted by this action.

Default: a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set