Skip to content
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

feat(AJV): Add missing provider level schema properties #8297

Merged
merged 22 commits into from Oct 1, 2020

Conversation

fredericbarthelet
Copy link
Contributor

@fredericbarthelet fredericbarthelet commented Sep 28, 2020

Closes: #8016

@fredericbarthelet fredericbarthelet marked this pull request as draft September 28, 2020 14:01
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2020

Codecov Report

Merging #8297 into master will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8297      +/-   ##
==========================================
- Coverage   88.08%   88.02%   -0.07%     
==========================================
  Files         250      249       -1     
  Lines        9368     9312      -56     
==========================================
- Hits         8252     8197      -55     
+ Misses       1116     1115       -1     
Impacted Files Coverage Δ
lib/plugins/aws/package/lib/mergeIamTemplates.js 100.00% <ø> (ø)
lib/plugins/aws/deploy/lib/createStack.js 97.61% <100.00%> (ø)
lib/plugins/aws/lib/updateStack.js 98.48% <100.00%> (ø)
...ib/plugins/aws/package/lib/generateCoreTemplate.js 95.12% <100.00%> (-0.34%) ⬇️
lib/plugins/aws/provider/awsProvider.js 93.04% <100.00%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd9a011...f764377. Read the comment docs.

@fredericbarthelet
Copy link
Contributor Author

@medikoo, while working on this PR, I stumbled upon S3 bucket name validation, for which one full service was dedicated (https://github.com/serverless/serverless/blob/master/lib/plugins/aws/lib/validateS3BucketName.js). This service allows use of . within bucket's name.

However, as specified by AWS documentation for bucket name, bucket name including dots won't be able to use S3 transfer acceleration.

Therefore, using a logic similar to the discussion we had regarding schema limitation of lambda env (limited to Ref and GetAtt only since invoke local only support those), would you like me to limit bucket name, when specified, to non-doted ones only ?

@fredericbarthelet fredericbarthelet marked this pull request as ready for review September 28, 2020 16:50
@fredericbarthelet fredericbarthelet changed the title WIP: feat(AJV): Add missing provider level schema properties feat(AJV): Add missing provider level schema properties Sep 29, 2020
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @fredericbarthelet ! It looks very promising. Great cleanup, I've picked just few potential issues.

Therefore, using a logic similar to the discussion we had regarding schema limitation of lambda env (limited to Ref and GetAtt only since invoke local only support those), would you like me to limit bucket name, when specified, to non-doted ones only ?

Good question. I would enable dot, and ensure we throw with meaningful error if it's used and S3 acceleration is enabled (it's opt-in as I see).

Also as I think more about it now, we should have done probably the same to env vars (so allow all formats acceptable for deployment, but throw with meaningful error if local invocation is pursued with not supported env vars - but let's not cover this in this PR)

lib/plugins/aws/provider/awsProvider.js Outdated Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Outdated Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Outdated Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Outdated Show resolved Hide resolved
@fredericbarthelet
Copy link
Contributor Author

Also as I think more about it now, we should have done probably the same to env vars (so allow all formats acceptable for deployment, but throw with meaningful error if local invocation is pursued with not supported env vars - but let's not cover this in this PR)

S3 acceleration is already disabled when a custom bucketName is provided, wether it includes a dot or not, thanks to the following code block

if (bucketName) {
return BbPromise.bind(this)
.then(() => this.validateS3BucketName(bucketName))
.then(() => {
if (isS3TransferAccelerationEnabled) {
const warningMessage =
'Warning: S3 Transfer Acceleration will not be enabled on deploymentBucket.';
this.serverless.cli.log(warningMessage);
}

The original commit I made allowed for dot within bucket name. Considering your answer, I keep it that way :)

@medikoo
Copy link
Contributor

medikoo commented Sep 30, 2020

S3 acceleration is already disabled when a custom bucketName is provided, whether it includes a dot or not, thanks to the following code block

@fredericbarthelet indeed, good point, btw. I've already improved env vars handling with #8307, so that's covered

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great @fredericbarthelet I've commented just on a few last things, and we should be good to go!

lib/plugins/aws/provider/awsProvider.js Outdated Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredericbarthelet this looks very good, and seems ready to take! I have just one concern which I forgot to add in previous reviews. Let me know.

lib/plugins/aws/provider/awsProvider.js Show resolved Hide resolved
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @fredericbarthelet! It's great to have that in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config schema: Define AWS "provider" properties (top level only)
3 participants