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): Add logging options to codeBuildDefaults property #24016

Closed
wants to merge 32 commits into from

Conversation

yo-ga
Copy link
Contributor

@yo-ga yo-ga commented Feb 5, 2023

Add logging options to pipeline.codeBuildDefaults property.

Closes #22045 #23676.
截圖 2023-02-05 上午10 44 12


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 Feb 5, 2023

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

@aws-cdk-automation aws-cdk-automation dismissed their stale review February 5, 2023 03:04

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

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Really great work here, I just have a few comments inline.

Comment on lines 771 to 783
logging: {
cloudWatch: {
logGroup: logGroup,
prefix: 'prefix',
enabled: true,
},
s3: {
encrypted: true,
bucket: bucket,
prefix: 's3prefix',
enabled: true,
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we can make this a little less manual for the user. For instance, if they're adding cloudwatch logging, I'd assume that they want enabled: true. Can we abstract some of this away? Maybe with a class similar to Schedule in aws-events that uses an enum like class. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree about providing human-friendly interfaces in high-level constructs. However, it would let users lose control if we overpack the functions. Users are able to set options separately for CloudWatch & S3 logging in aws-codebuild API, but not for Schedule in aws-events API.

I prefer to keep the current solution. But in the future, if any contributor requests a similar feature, we can design the interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to @TheRealAmazonKendra's suggestion. Users will still be able to maintain full control. We could potentially do a separate property: eg, cloudwatchLogging, s3Logging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before abstracting the logging setting, I'd like to confirm the expected result when the user doesn't assign the object to CloudWatch logging. For now, CloudWatch logging is still enabled and saves the log to the default pattern.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra Feb 12, 2023

Choose a reason for hiding this comment

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

Let's leave the behavior as is if the user doesn't provide any input. I suppose we could have something like Logging.NONE() for logs to be disabled altogether, but we should leave the default alone so we don't unintentionally break customers code that might rely on it.

*
* @default - no log configuration is set
*/
readonly logging?: codebuild.LoggingOptions;
Copy link
Contributor

Choose a reason for hiding this comment

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

My comment above may mean refactoring LoggingOptions instead of building a new interface for this specifically. In fact, that's probably the best path forward. We could improve this experience in general.

Comment on lines 3 to 6
export function mergeLoggings(a: codebuild.LoggingOptions, b?: codebuild.LoggingOptions): codebuild.LoggingOptions | undefined;
export function mergeLoggings(a: codebuild.LoggingOptions | undefined, b: codebuild.LoggingOptions): codebuild.LoggingOptions | undefined;
export function mergeLoggings(a?: codebuild.LoggingOptions, b?: codebuild.LoggingOptions): codebuild.LoggingOptions | undefined;
export function mergeLoggings(a?: codebuild.LoggingOptions, b?: codebuild.LoggingOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add spacing between these for my delicate eyeballs, please.

Copy link
Contributor

Choose a reason for hiding this comment

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

Granted, with my suggestions above, these might not be needed.

Copy link
Contributor Author

@yo-ga yo-ga Feb 10, 2023

Choose a reason for hiding this comment

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

Is there any suggestion for a coding style?
It seems that other overloading functions are followed like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

you know, I didn't even notice that it was an overloaded function because I reacted too quickly to the spacing issue. This is appropriate and my eyeballs will deal, lol.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review February 10, 2023 14:53

Pull request has been modified.

Comment on lines 771 to 783
logging: {
cloudWatch: {
logGroup: logGroup,
prefix: 'prefix',
enabled: true,
},
s3: {
encrypted: true,
bucket: bucket,
prefix: 's3prefix',
enabled: true,
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to @TheRealAmazonKendra's suggestion. Users will still be able to maintain full control. We could potentially do a separate property: eg, cloudwatchLogging, s3Logging

@mergify mergify bot dismissed comcalvi’s stale review February 11, 2023 04:38

Pull request has been modified.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Putting this back into changes requested to reflect the status.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@MrArnoldPalmer
Copy link
Contributor

@yo-ga, circling back on this, what information do you need to move forward with the refactor? Read through the context but summarize for me so I can catch up.

@yo-ga
Copy link
Contributor Author

yo-ga commented Mar 26, 2023

@MrArnoldPalmer sorry for missing some days.
I have already refactored the logging interface and supported the logging attributes for CodeBuildStep
This PR could be reviewed again.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

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 5, 2023 11:40

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

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@yo-ga
Copy link
Contributor Author

yo-ga commented Apr 25, 2023

This feature has been already implemented from #25266. I would close this PR.
@comcalvi @TheRealAmazonKendra if we still need to refactor the property, it would be better to create a new issue.

@yo-ga yo-ga closed this Apr 25, 2023
@yo-ga yo-ga deleted the feature/22045 branch April 25, 2023 19:09
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 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
6 participants