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

chore(logs): migrate log retention handler #27814

Merged
merged 16 commits into from
Nov 17, 2023
Merged

Conversation

colifran
Copy link
Contributor

@colifran colifran commented Nov 2, 2023

This PR moves the log retention handler from aws-cdk-lib to our new centralized location for custom resource handlers in the @aws-cdk package.


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 the p2 label Nov 2, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team November 2, 2023 17:07
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 2, 2023
@colifran colifran added the pr/do-not-merge This PR should not be merged at this time. label Nov 2, 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.

Signed-off-by: Francis <[email protected]>
Signed-off-by: Francis <[email protected]>
@colifran colifran changed the title chore(logs): migrate log retention handler to centralized location for custom resource handlers in @aws-cdk chore(logs): migrate log retention handler to centralized location for custom resource handlers in aws-cdk Nov 2, 2023
@colifran colifran changed the title chore(logs): migrate log retention handler to centralized location for custom resource handlers in aws-cdk chore: migrate log retention handler to centralized location for custom resource handlers in @aws-cdk Nov 2, 2023
@colifran colifran changed the title chore: migrate log retention handler to centralized location for custom resource handlers in @aws-cdk chore(logs): test title Nov 2, 2023
Signed-off-by: Francis <[email protected]>
Signed-off-by: Francis <[email protected]>
Signed-off-by: Francis <[email protected]>
@colifran colifran changed the title chore(logs): test title chore(logs): migrate log retention handler to centralized location for custom resource handlers in @aws-cdk Nov 3, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 3, 2023 03:23

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

Signed-off-by: Francis <[email protected]>
Signed-off-by: Francis <[email protected]>
Signed-off-by: Francis <[email protected]>
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 3, 2023
@colifran colifran changed the title chore(logs): migrate log retention handler to centralized location for custom resource handlers in @aws-cdk chore(logs): migrate log retention handler Nov 6, 2023
@colifran colifran marked this pull request as draft November 7, 2023 17:46
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 9, 2023
@colifran colifran marked this pull request as ready for review November 16, 2023 21:16
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 16, 2023
@colifran colifran removed the pr/do-not-merge This PR should not be merged at this time. label Nov 17, 2023
@vinayak-kukreja vinayak-kukreja self-assigned this Nov 17, 2023
Copy link
Contributor

mergify bot commented Nov 17, 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 aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 17, 2023
Copy link
Contributor

mergify bot commented Nov 17, 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: 0551837
  • 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 1115110 into main Nov 17, 2023
12 checks passed
@mergify mergify bot deleted the colifran/migrate-log-retention branch November 17, 2023 19:32
Copy link
Contributor

mergify bot commented Nov 17, 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).

@@ -148,7 +148,7 @@ class LogRetentionFunction extends Construct implements cdk.ITaggable {
super(scope, id);

const asset = new s3_assets.Asset(this, 'Code', {
path: path.join(__dirname, 'log-retention-provider'),
path: path.join(__dirname, '..', '..', 'custom-resource-handlers', 'dist', 'aws-logs', 'log-retention-handler'),
Copy link
Contributor

Choose a reason for hiding this comment

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

@colifran Is this the correct path that needs to be set here? The resource is not located there, all the tests that are reaching this code fail unless I change the path to:

const asset = new s3_assets.Asset(this, 'Code', {
      path: path.join(__dirname, '..', '..', '..', '@aws-cdk', 'custom-resource-handlers', 'lib', 'aws-logs', 'log-retention-handler'),
    });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have you rebuilt aws-cdk-lib with npx lerna run build --scope=aws-cdk-lib --skip-nx-cache? The log retention handler was moved to @aws-cdk/custom-resource-handlers/lib/aws-logs/log-retention-handler, but when aws-cdk-lib is built the handler will be bundled and minified, and then we airlift all the bundled and minified handlers into the location pointed to by the updated code path you're referencing. I just cloned and built a fresh package without any problems to verify.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the explanation. I am still new to the codebase and I'm trying to run the tests directly from the test file. Since it is working fine on your side I will follow the instructions and hope to have success too 👍 Thank you for the fast reply 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. I'm happy to help!

@@ -517,7 +517,7 @@ describe('log retention', () => {
stack.node.setContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT, true);
stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true);

const assetLocation = path.join(__dirname, '../', '/lib', '/log-retention-provider');
const assetLocation = path.join(__dirname, '..', '..', 'custom-resource-handlers', 'dist', 'aws-logs', 'log-retention-handler');
Copy link
Contributor

Choose a reason for hiding this comment

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

@colifran This test here also fails with the path set like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. handler-migration p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants