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(pipelines): added logging as option for codeBuildDefaults prop on CodePipeline construct #25266

Merged
merged 10 commits into from
Apr 25, 2023

Conversation

colifran
Copy link
Contributor

@colifran colifran commented Apr 24, 2023

Motivation:

Logging is an optional prop as part of the Project construct in the aws-codebuild module. Users can link a codebuild action when as part of their CodePipeline with codebuild options being set via the codeBuildDefaults prop on the CodePipeline construct. Currently, there isn't any ability to enable logging for the codebuild action. This feature allows a user to enable logging as part of a linked codebuild action via S3, CloudWatch, or both.

Use Case (from issue #22045):

At my company we just enabled AWS Config and SecurityHub has generated a rule 'securityhub-codebuild-project-logging-enabled-abcxyz'. This rule states that all CodeBuild projects must have at least one logging option enabled.

However the Build and Synth steps from the pipeline are always failing this check since the pipelines module doesn't allow specifying logging options on the nested CodeBuild projects.

Testing:

Unit testing was implemented to verify that the CloudFormation template would be synthesized correctly when logging selected as an option on the codeBuildDefaults prop for S3, CloudWatch, or both.

Integration testing was implemented to verify that all resources would be successfully provisioned when a new CodePipeline is created with logging enabled for the codebuild action.

Closes #22045


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

@gitpod-io
Copy link

gitpod-io bot commented Apr 24, 2023

@aws-cdk-automation aws-cdk-automation requested a review from a team April 24, 2023 14:14
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Apr 24, 2023
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.

@aws-cdk-automation aws-cdk-automation dismissed their stale review April 24, 2023 14:39

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

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 24, 2023
Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

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

Great job @colifran 🚀

@mergify
Copy link
Contributor

mergify bot commented Apr 25, 2023

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit d479b4d into main Apr 25, 2023
@mergify mergify bot deleted the colifran/add-logging-to-code-build-defaults branch April 25, 2023 10:42
@mergify
Copy link
Contributor

mergify bot commented Apr 25, 2023

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).

madeline-k pushed a commit that referenced this pull request Apr 27, 2023
…n CodePipeline construct (#25266)

## Motivation:
Logging is an optional prop as part of the Project construct in the aws-codebuild module. Users can link a codebuild action when as part of their CodePipeline with codebuild options being set via the codeBuildDefaults prop on the CodePipeline construct. Currently, there isn't any ability to enable logging for the codebuild action. This feature allows a user to enable logging as part of a linked codebuild action via S3, CloudWatch, or both.

## Use Case (from issue #22045):
At my company we just enabled AWS Config and SecurityHub has generated a rule 'securityhub-codebuild-project-logging-enabled-abcxyz'. This rule states that all CodeBuild projects must have at least one logging option enabled.

However the Build and Synth steps from the pipeline are always failing this check since the pipelines module doesn't allow specifying logging options on the nested CodeBuild projects.

## Testing:
Unit testing was implemented to verify that the CloudFormation template would be synthesized correctly when logging selected as an option on the codeBuildDefaults prop for S3, CloudWatch, or both.

Integration testing was implemented to verify that all resources would be successfully provisioned when a new CodePipeline is created with logging enabled for the codebuild action.

Closes #22045

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pipelines: Add logging options to codeBuildDefaults property
3 participants