feat(codepipeline-actions): support commands action
My TODO
- Implementation
- Errors in commands
-
zip: not a valid zip file for primary source
-
- validation for multi-line formats
- Verify the actual operation in console or CFn first
- other validations
- arrays etc...
- outputVariables
- files in OutputArtifact
- arrays etc...
- Errors in commands
- unit tests
- CommandsAction
- can define with full props
- with an output artifact with files
- calling
variablemethod - error tests
- outputVariables in
variablemethod - multi-line formats
- outputVariables in
- can define with full props
- tests in aws-codepipeline
- artifacts.test.ts, etc...
- CommandsAction
- integ tests and snapshots
- README
- how to use CommandsAction
- how to use outputVariables
- how to attach policies
- new integ test?
Issue # (if applicable)
Closes #31666.
Reason for this change
AWS CodePipeline introduces new general purpose compute action: Commands action.
- https://aws.amazon.com/about-aws/whats-new/2024/10/aws-codepipeline-general-purpose-compute-action/
- https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-Commands.html#action-reference-Commands-type
This action can be used for both V1 and V2 pipeline types.
CFn docs:
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-actiontypeid.html
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-outputartifact.html
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-actiondeclaration.html
Description of changes
Added CommandsAction class and changed other files.
The ActionCategory for this action is a new category Compute, so added ActionCategory.COMPUTE.
Description of how you validated changes
Both unit and integ tests
Checklist
- [x] My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
The CodeBuild run under the CommandsAction. But I don't automatically add the permissions for source services with CODEBUILD_CLONE_REF (codeBuildCloneOutput=true).
https://github.com/aws/aws-cdk/blob/v2.161.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codebuild/build-action.ts#L189-L211
https://github.com/aws/aws-cdk/blob/v2.161.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codestar-connections/source-action.ts#L158-L159
Because an error occurred in the CommandsAction with CODEBUILD_CLONE_REF.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 80.83%. Comparing base (
873233b) to head (bfaa773).
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
| Flag | Coverage Δ | |
|---|---|---|
| suite.unit | 80.83% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| packages/aws-cdk | 79.56% <ø> (ø) |
|
| packages/aws-cdk-lib/core | 82.20% <ø> (ø) |
@GavinZZ
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.
https://github.com/aws/aws-cdk/pull/31667/commits/8b8c5d7c17bf7864819309ee7be7f64580024071
ref-1: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-Commands.html#action-reference-Commands-policy
ref-2: https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam-permissions-console-logs.html
Also, the integ test was slightly modified.
~~I'm investigating the CI failure because it creates differences in snapshots.~~
It seems to have been fixed after full build with the latest commit in main branch, soI will run CI again.
@GavinZZ CI has succeeded. Could you please check it again?
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
- CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
- Commit ID: bfaa7733596a9bcb87ef4bc7587a75f24d75f512
- Result: SUCCEEDED
- Build Logs (available for 30 days)
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. If you need help, please open a new issue that references this one.