feat(codepipeline-actions): support commands action#31667
feat(codepipeline-actions): support commands action#31667mergify[bot] merged 45 commits intoaws:mainfrom
Conversation
add module code
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
| APPROVAL = 'Approval', | ||
| DEPLOY = 'Deploy', | ||
| INVOKE = 'Invoke', | ||
| COMPUTE = 'Compute', |
There was a problem hiding this comment.
| // To put the logs in the log group | ||
| // see: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-Commands.html#action-reference-Commands-policy | ||
| 'logs:CreateLogGroup', | ||
| 'logs:CreateLogStream', | ||
| 'logs:PutLogEvents', |
There was a problem hiding this comment.
| // To view the logs in the Commands action on the CodePipeline console | ||
| // see: https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam-permissions-console-logs.html | ||
| 'logs:GetLogEvents', |
There was a problem hiding this comment.
|
|
||
| /** | ||
| * Shell commands for the Commands action to run. | ||
| * | ||
| * @default - no commands | ||
| */ | ||
| readonly commands?: string[]; | ||
|
|
||
| /** | ||
| * The names of the variables in your environment that you want to export. | ||
| * | ||
| * @default - no output variables | ||
| */ | ||
| readonly outputVariables?: string[]; |
There was a problem hiding this comment.
| * @param files file paths that you want to export as output artifacts for the action. (can only be used in artifacts for `CommandAction`) | ||
| */ | ||
| public static artifact(name: string): Artifact { | ||
| return new Artifact(name); | ||
| public static artifact(name: string, files?: string[]): Artifact { | ||
| return new Artifact(name, files); |
There was a problem hiding this comment.
|
The CodeBuild run under the CommandsAction. But I don't automatically add the permissions for source services with Because an error occurred in the CommandsAction with |
GavinZZ
left a comment
There was a problem hiding this comment.
Thank you as always for the contribution! Just curious on the design decision.
| provider: 'Commands', | ||
| artifactBounds: { minInputs: 1, maxInputs: 10, minOutputs: 0, maxOutputs: 1 }, | ||
| inputs: [props.input, ...props.extraInputs || []], | ||
| outputs: props.output ? [props.output] : [], |
There was a problem hiding this comment.
since CFN L1 resource can take a list of items as outputs, I'm curious on the design decision on output being one item instead of a list of artifacts?
There was a problem hiding this comment.
The number of output artifacts can only be 0 to 1 on the Commands action.
Output artifacts
Number of artifacts: 0 to 1
So I made it output as an optional param that can be 0 to 1.
Various actions including the commands action use the same CFn type, so it seems the CFn needs to get an array type.
packages/aws-cdk-lib/aws-codepipeline-actions/lib/commands/commands-action.ts
Show resolved
Hide resolved
| provider: 'Commands', | ||
| artifactBounds: { minInputs: 1, maxInputs: 10, minOutputs: 0, maxOutputs: 1 }, | ||
| inputs: [props.input, ...props.extraInputs || []], | ||
| outputs: props.output ? [props.output] : [], |
There was a problem hiding this comment.
The number of output artifacts can only be 0 to 1 on the Commands action.
Output artifacts
Number of artifacts: 0 to 1
So I made it output as an optional param that can be 0 to 1.
Various actions including the commands action use the same CFn type, so it seems the CFn needs to get an array type.
packages/aws-cdk-lib/aws-codepipeline-actions/lib/commands/commands-action.ts
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #31667 +/- ##
=======================================
Coverage 80.83% 80.83%
=======================================
Files 236 236
Lines 14251 14251
Branches 2490 2490
=======================================
Hits 11520 11520
Misses 2446 2446
Partials 285 285
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
I am not sure if the document has changed since I saw it or if I was mistaken, but I have changed the policies to match the document. ref-2: https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam-permissions-console-logs.html Also, the integ test was slightly modified. |
|
It seems to have been fixed after full build with the latest commit in main branch, soI will run CI again. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
@GavinZZ |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |

Issue # (if applicable)
Closes #31666.
Reason for this change
AWS CodePipeline introduces new general purpose compute action: Commands action.
CFn docs:
Description of changes
Added
CommandsActionclass and changed other files.The
ActionCategoryfor this action is a new categoryCompute, so addedActionCategory.COMPUTE.Description of how you validated changes
Both unit and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license