-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(core): pressing Ctrl-C when content is bundled leaves broken asset #33692
Conversation
When a bundling command is interrupted with Ctrl-C, the asset output directory has already been created. On the next synthesis, we assume the asset has already successfully been produced, don't do any bundling, and upload it. We will then have produced and uploaded a broken asset. Instead, the common pattern to handle this is: - Do the work into a temporary directory - Rename the temporary directory to the target directory only if the work succeeds.
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.
(This review is outdated)
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.
Approving with do-not-merge
.
@@ -3,7 +3,7 @@ | |||
exports[`esbuild bundling with esbuild options 1`] = ` | |||
""use strict"; | |||
(() => { | |||
// aws-lambda-nodejs/test/handlers/define.ts | |||
// ../../../../PublicCDK/aws-cdk/packages/aws-cdk-lib/aws-lambda-nodejs/test/handlers/define.ts |
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.
wut wut
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.
¯_(ツ)_/¯
@@ -675,6 +676,43 @@ describe('staging', () => { | |||
]); | |||
}); | |||
|
|||
test('if bundling is interrupted, target asset directory is not produced', () => { |
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.
Would be nice to also have a test that reruns bundling that now succeeds, to ensure the existence of the -building
directory doesn't break anything. Up to you though, it might be overdoing it.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33692 +/- ##
==========================================
+ Coverage 82.21% 82.24% +0.02%
==========================================
Files 119 119
Lines 6876 6875 -1
Branches 1162 1161 -1
==========================================
+ Hits 5653 5654 +1
+ Misses 1120 1118 -2
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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). |
Comments on closed issues and PRs are hard for our team to see. |
When a bundling command is interrupted with Ctrl-C, the asset output directory has already been created. On the next synthesis, we assume the asset has already successfully been produced, don't do any bundling, and upload it.
We will then have produced and uploaded a broken asset.
Instead, the common pattern to handle this is:
Closes #33201, closes #32869, relates to #14474.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license