-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(codepipeline-actions): support commands action #31667
Conversation
add module code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -13,6 +13,7 @@ export enum ActionCategory { | |||
APPROVAL = 'Approval', | |||
DEPLOY = 'Deploy', | |||
INVOKE = 'Invoke', | |||
COMPUTE = 'Compute', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
/** | ||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review! I have replied and hope you take a look at it.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
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
CommandsAction
class and changed other files.The
ActionCategory
for 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