Skip to content
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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Oct 5, 2024

Issue # (if applicable)

Closes #31666.

Reason for this change

AWS CodePipeline introduces new general purpose compute action: Commands action.

This action can be used for both V1 and V2 pipeline types.

CFn docs:

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


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Oct 5, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team October 5, 2024 17:19
@github-actions github-actions bot added the distinguished-contributor [Pilot] contributed 50+ PRs to the CDK label Oct 5, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a 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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +86 to +90
// 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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +91 to +93
// 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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +108 to +121

/**
* 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[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 14 to 17
* @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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@go-to-k
Copy link
Contributor Author

go-to-k commented Oct 5, 2024

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.

clone-ref

@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Oct 6, 2024
@go-to-k go-to-k changed the title feat(codepipeline-actions): support Commands action feat(codepipeline-actions): support commands action Oct 6, 2024
@go-to-k go-to-k marked this pull request as ready for review October 25, 2024 16:00
@go-to-k go-to-k marked this pull request as draft October 25, 2024 16:00
@aws-cdk-automation aws-cdk-automation dismissed their stale review October 25, 2024 16:02

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@go-to-k go-to-k marked this pull request as ready for review October 26, 2024 15:36
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: f0a238d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

codepipeline-actions: support Commands action
2 participants