-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): pressing Ctrl-C when content is bundled leaves broken asset (
#33692) 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. 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*
- Loading branch information
Showing
5 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/aws-cdk-lib/core/test/app-that-is-interrupted-during-staging.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* This is a CDK app that is guaranteed to kill itself during bundling | ||
*/ | ||
import * as path from 'path'; | ||
import { App, AssetStaging, DockerImage, Stack } from '../lib'; | ||
|
||
const app = new App(); | ||
const stack = new Stack(app, 'stack'); | ||
const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); | ||
|
||
const pid = process.pid; | ||
|
||
// WHEN | ||
new AssetStaging(stack, 'Asset', { | ||
sourcePath: directory, | ||
bundling: { | ||
image: DockerImage.fromRegistry('alpine'), | ||
command: ['DOCKER_STUB_EXEC', 'kill', `${pid}`], | ||
}, | ||
}); | ||
|
||
app.synth(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters