-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Conversation
Signed-off-by: Francis <colifran@amazon.com>
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.
Signed-off-by: Francis <colifran@amazon.com>
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Signed-off-by: Francis <colifran@amazon.com>
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). |
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). |
@@ -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'), |
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.
@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'),
});
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.
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.
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 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 💯
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.
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'); |
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.
@colifran This test here also fails with the path set like that.
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