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
Add config to deploymentBucket to support S3 bucket versioning #9912
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9912 +/- ##
==========================================
+ Coverage 85.38% 85.41% +0.02%
==========================================
Files 333 333
Lines 13571 13586 +15
==========================================
+ Hits 11588 11604 +16
+ Misses 1983 1982 -1
Continue to review full report at Codecov.
|
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.
Thanks @mars-lan - great call 👍 I have only minor comments, please let me know what do you think.
Additionally, it would be good to add a note about this property here: https://github.com/serverless/serverless/blob/master/docs/providers/aws/guide/deploying.md#tips
test/unit/lib/plugins/aws/package/lib/generateCoreTemplate.test.js
Outdated
Show resolved
Hide resolved
Thanks @mars-lan 🙇 Before moving forward, I will test it out locally as I'm not 100% sure if bucket with versioning enabled will behave correctly when it comes to clearing previous deployment artifacts as well as during whole service teardown. Did you test that by any chance? |
@pgrzesik you're correct. The current AWS bucket cleanup code is not version aware and will only delete the latest version when |
Verified with the latest change,
|
Ping @pgrzesik ? |
Thanks for the update @mars-lan 🙇 I'm a bit swamped with other things at the moment but I will try my best to review and test it before the end of the week. |
Gentle ping, @pgrzesik |
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.
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 @mars-lan ! It looks very good. I have just few very minor style concerns, and tests need to be updated to use our latest methodology
@@ -80,6 +80,66 @@ describe('emptyS3Bucket', () => { | |||
}); | |||
}); | |||
|
|||
describe('#listObjectVersions()', () => { | |||
it('should resolve if no object versions are present', () => { | |||
const listObjectVersionsStub = sinon.stub(awsRemove.provider, 'request').resolves(); |
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.
All new tests should be configured with runServerless
util.
It's documented here: https://github.com/serverless/test/blob/master/docs/run-serverless.md
Also search the code for many examples on how it's used.
I believe in this given case we need to stub AWS SDK with awsRequestStubMap
option. And via stubs we should confirm that expected objest from S3 bucket were attempted to be removed
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.
Tried my best to follow the new convesion base on the examples I could find. Let me know if I'm doing it wrong.
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.
@mars-lan great thanks for update. It looks great!
Let's just use async/await syntax and it's good to take
The failed test seems flakey and unrelated: https://github.com/serverless/serverless/pull/9912/checks?check_run_id=3861777865 |
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 @mars-lan ! There's still some parts where async/await is not applied.
We've also fixed flaky test, so please also rebase against master
Merged |
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 @mars-lan ! That looks great
@pgrzesik please review (it looks that it's needed to clear the status) |
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.
Looks great, well done @mars-lan 👏
Hey @mars-lan - I plan to do a release today, it was supposed to come out yesterday, but Github had issues for the better part of the day so it was delayed. |
@pgrzesik gentle ping. |
@mars-lan It has been released with 2.63.0 release |
Closes: #5797 (again)
The original issue asked to support both encryption & versioning for the S3 deployment bucket and #5800 only addressed the first former. This PR adds an additional
versioning
config to support the latter.