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

fix(manifest): preserve default entrypoint and command on empty env overrides #2490

Merged
merged 2 commits into from
Jun 21, 2021

Conversation

Lou1415926
Copy link
Contributor

This fixes the bug where an empty environment entrypoint/command will replace the default entrypoint/command in manifest if they are specified as list.

This is because an empty list []string isn't considered a zero value, hence mergo will use the empty list to replace the original list.

This is the same fix as #2442, only it's on entrypoint and command overrides.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Lou1415926 Lou1415926 requested a review from a team as a code owner June 21, 2021 14:45
@Lou1415926 Lou1415926 requested review from huanjani and removed request for a team June 21, 2021 14:45
Copy link
Contributor

@efekarakus efekarakus left a comment

Choose a reason for hiding this comment

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

Cool thank you!!

I don't know how we can enforce a mechanism yet since this has been a fragile section of our codebase, but noting here things we learned:

  1. New manifest fields need to be pointers, so that mergo doesn't override them with empty structs due to mergo.withOverriteWithEmptyValue
  2. Override logic won't appear in our code coverage, so we just have to ensure in our PRs that we have unit tests for them

Copy link
Contributor

@bvtujo bvtujo left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for this!

@iamhopaul123 iamhopaul123 added do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. and removed do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. labels Jun 21, 2021
@mergify mergify bot merged commit ecffb5e into aws:mainline Jun 21, 2021
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
…verrides (aws#2490)

This fixes the bug where an empty environment `entrypoint`/`command` will replace the default `entrypoint`/`command` in manifest if they are specified as list.

This is because an empty list `[]string` isn't considered a zero value, hence `mergo` will use the empty list to replace the original list.

This is the same fix as aws#2442, only it's on entrypoint and command overrides.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants