-
Notifications
You must be signed in to change notification settings - Fork 428
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
fix(cli): autoscaling range default value #1469
Conversation
8704f83
to
d818330
Compare
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.
This is awesome Thank you so much for finding and fixing this bug!
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.
Heya! thanks for the contribution!
Is there a test case like described in the description that shows that after ApplyEnv
is invoked the range remains as expected instead of the empty string ""
OK I see it now :) yay thank you! |
<!-- Provide summary of changes --> When using the following manifest file and deploying on `production` env, the `range` value is set to an empty string : ```yaml name: foobar type: Load Balanced Web Service image: build: Dockerfile port: 80 count: range: 2-6 cpu_percentage: 70 memory_percentage: 80 environments: production: variables: MODE: production ``` After running the command: ``` # copilot svc package -n foobar -e production --output-dir /tmp/out ✘ generate stack template: convert the Auto Scaling configuration for service adminapi: invalid range value . Should be in format of ${min}-${max} ``` This bug comes from this code: ```go // internal/pkg/manifest/lb_web_svc.go func (s LoadBalancedWebService) ApplyEnv(envName string) (*LoadBalancedWebService, error) { // ... err := mergo.Merge(&s, LoadBalancedWebService{ LoadBalancedWebServiceConfig: *overrideConfig, }, mergo.WithOverride, mergo.WithOverwriteWithEmptyValue) ``` As the `mergo.WithOverwriteWithEmptyValue` option is used, the `Autoscaling.Range` value is overrided by the default one, which is an empty string. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
When using the following manifest file and deploying on
production
env, therange
value is set to an empty string :After running the command:
This bug comes from this code:
As the
mergo.WithOverwriteWithEmptyValue
option is used, theAutoscaling.Range
value is overrided by the default one, which is an empty string.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.