-
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
cdk-assets: Remove asset from staging bucket on failed deployment #14474
Comments
Reassigning to @rix0rrr |
We seem to be experiencing the same issue. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Please do not auto-close this issue. |
when you interrupt a deploy with Ctrl-C you also might end up with corrupted asset directories(*) for 3rd party layers. These asset directories will then be zipped, uploaded and cached. It is very hard to recover from that state. (*) in my case the 3rd party layer is created by 'pip' in a docker. |
Good find! If we can, we should try and switch to multipart uploads. Those are atomic by default, and the file will only appear if the upload completes. Depends on whether wr already have the correct s3 permissions on the asset role though... |
Multipart shouldn't need any additional permissions, so we should be good to deploy that. Does need an additional lifecycle rule on the bucket to remove old multiparts though. |
I don't think that we are exactly talking about the same issue here. I my case I hit Ctrl-C while the (*)
|
Oh I see, this isn't about the upload but about the build. I misunderstood. We've fixed this for zipping (by building to a tempfile), but apparently not for bundling. That'll be the solution for bundling as well then. |
In #12536, it has been noted that part of the problem is that a corrupted zip file may be uploaded to the staging bucket. At this point, CDK will no-longer attempt to upload the asset, again, because it detects that an asset with the corresponding hash resides within the bucket. After reaching this state, it is necessary to manually remove the affected asset, or assets, from the staging bucket before a successful deployment can occur. In cases where the deployment of a given asset fails, the asset should be removed from the staging bucket to ensure that this "broken" state is not reached.
Use Case
This change would help ensure that CDK does not attempt to use a corrupt pre-existing asset from the staging bucket during deployment.
Alternatives
Provide a CLI flag to ensure that assets are overwritten in the staging bucket on every deployment.
Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: