Repository navigation
Update packaging to support individual packages per function - #1917
Conversation
|
@flomotlik @pmuens this is ready for review when you're able. |
|
@johncmckim pretty neat implementation! Thanks a lot! Unfortunately, based on my understanding of other providers, I think this plugin is only/mostly relevant to AWS. For example, Azure doesn't have a concept of "handlers" to begin with and functions need to be in the top level of the service. So I'm thinking the directory structure of other providers might be different and more rigid. nonetheless, awesome PR! 💪 .... It'd be awesome if you could include the Sinon enhancements you mentioned in your TODOs (checking args, call counts..etc) to make the tests more precise. After that it's G2M |
|
@eahefnawy thanks for looking at it. I have updated the tests to check args. I used the I just realised I haven't updated the docs yet. If you're happy with the usability of the config, I'll update the docs. |
|
Awesome! thanks a lot! yep I think they're good to go. One other tiny thing, since it's packaging related (but not directly related to this PR), could you update the cleanup() {
if (this.serverless.config.servicePath) {
const serverlessTmpDirPath = path.join(this.serverless.config.servicePath, '.serverless');
if (this.serverless.utils.dirExistsSync(serverlessTmpDirPath)) {
fse.removeSync(serverlessTmpDirPath);
}
}
return BbPromise.resolve();
},Would be awesome to close this related issue as well with this PR 😊 |
|
Can do. I'll update it tomorrow morning (AUS time). |
|
I thought about the individually flag a bit and while its not the best usability to have to set things in two locations it provides a nice feature for people to be able to turn individual deployment on or off and so easily test both. Otherwise they would have to go in and configure it separately. And we can remove it easily in the future if we want to. Still unsure about the union of service and function config, but I think its more often the case that people want to set something up that is a bit different from the general service config, than configure it completely separately. So I'm fine with the UX of it at the moment, we can learn from it and improve in the future once we understand it a little better. Thanks @johncmckim for getting this implemented |
|
@eahefnawy @flomotlik I've updated the docs and fixed that service path issue. Let me know if there is anything else. No worries. I've enjoyed contributing to this project. I think I will be getting busy soon, but hopefully I'll be able to find time to keep contributing to the project. |
| memorySize: 512 # optional, default is 1024 | ||
| timeout: 10 # optional, default is 6 | ||
| package: # optional requires individual function packaging to be enabled | ||
| include: |
There was a problem hiding this comment.
looks like include is mentioned twice here
|
|
||
| it('should merge the IamRoleLambdaExecution template into the CloudFormation template', () => { | ||
| const IamRoleLambdaExecutionTemplate = awsCompileFunctions.serverless.utils.readFileSync( | ||
|
|
There was a problem hiding this comment.
Would be great if this whitespace could be removed
|
Hey @johncmckim thank you for this awesome PR! 👯 Just looked through it and added some (minor) comments. Furthermore here's what else I saw / would like to discuss:
Thanks in advance! And keep up the great work 🎉 |
|
@pmuens Thanks for the review. I think I have resolved all those issues.
Let me know if you see anything else |
|
@johncmckim thanks for the fixes! Looks good! Great work you've done here! 👍 🎉 |
| this.serverless.cli.log('Uploading .zip file to S3...'); | ||
|
|
||
| const body = fs.readFileSync(this.serverless.service.package.artifact); | ||
| if (this.serverless.service.package.individually) { |
There was a problem hiding this comment.
I just checked and it looks like this part of the function isn't really covered from a test:
Could you look into why this might be the case? Not sure if its simply not covered by the test or if there is some issue going on. I assume its simply a missing test where package.individually is set to true.
I'll also make sure that the code coverage is more visible for users
|
Thanks @flomotlik. I thought I had covered that but it may have been removed in a previous merge. Updated the tests to cover 100% of that file. I would have thought the status check would have failed with the reduced coverage? |
|
@johncmckim it only failed with -5% in the past, changed that to -0.1% now #makeitfail Thanks for the quick edit, merging this now. |
|
@johncmckim awesome job on this again. Sorry for the back and forth, we're definitely working on making sure that we have less of that in the future! |
|
@flomotlik no worries. I'm happy to get the feedback and happy that there are responsive maintainers. Glad to get this in, it's been fun. |
|
Perfect!!! |
Status:
Ready
Description:
Support per-function packages #1777
Todos:
deploy functionto support individual function packages