-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 --update-config flag to deploy function command #4173
Add --update-config flag to deploy function command #4173
Conversation
Works like a charm!! Thanks tons @RafalWilinski ! your contributions are priceless 😊 I'm thinking maybe update config should happen by default on |
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.
Great stuff @RafalWilinski (as usual!) 👍. You really rock 🎸 🤘.
I just looked through the code and added some comments.
I'm thinking maybe update config should happen by default on sls deploy function, what you think? cc @pmuens
IMHO that would be super nice! Great idea @eahefnawy. This would make the whole functionality a lot easier and IMHO is exactly what I'd expect if I run serverless function deploy
.
@@ -5,6 +5,7 @@ const _ = require('lodash'); | |||
const crypto = require('crypto'); | |||
const path = require('path'); | |||
const fs = require('fs'); | |||
const omitEmpty = require('omit-empty'); |
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.
Can't we use https://lodash.com/docs/4.17.4#omit for that?
package.json
Outdated
@@ -113,6 +113,7 @@ | |||
"minimist": "^1.2.0", | |||
"moment": "^2.13.0", | |||
"node-fetch": "^1.6.0", | |||
"omit-empty": "^0.4.1", |
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.
Can't we use _.omit
from lodash
for that? This way we'd save one external dependency.
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.
Unfortunately, from my experience _.omit
does not work for nested/deep values.
@@ -66,6 +72,38 @@ class AwsDeployFunction { | |||
}); | |||
} | |||
|
|||
updateFunctionConfiguration() { | |||
const params = omitEmpty({ |
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.
Does this include config which is defined on a the provider
level as well?
See: https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/
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.
Good catch!
@@ -78,7 +78,7 @@ This deployment method does not touch your AWS CloudFormation Stack. Instead, i | |||
serverless deploy function --function myFunction | |||
``` | |||
|
|||
**Note:** You can always enforce a deployment using the `--force` option. | |||
**Note:** You can always enforce a deployment using the `--force` option or `--update-config` to change function configuration. |
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.
I'd add a separate **Note:**
section below that since the --force
and --update-config
flags provide two distinct functionalities.
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.
Sure
Alright! thanks for the feedback @pmuens 😊 ... Let's do that then @RafalWilinski 👍 |
|
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 very much for this PR and the updates @RafalWilinski 👍
I just tested it today and it's working great! GTM -->
What did you implement:
Closes #4042
As issue suggests, this PR uses only UpdateFunctionConfiguration, so it does zero changes to CloudFormation template.
How can we verify it:
Deploy simple service:
And then change some config values & run
serverless deploy function -f hello -u
Todos:
Is this ready for review?: YES
Is it a breaking change?: NO