-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: If image functions have same metadata, only 1st one is in the result #2624
fix: If image functions have same metadata, only 1st one is in the result #2624
Conversation
@@ -193,6 +193,30 @@ def test_build_layers_and_functions(self, mock_copy_tree, mock_path): | |||
str(mock_path(given_build_dir, self.function1_2.name)), | |||
) | |||
|
|||
def test_build_single_function_definition_image_functions_with_same(self, mock_copy_tree, mock_path): |
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.
should we also add an integ test for this?
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
samcli/lib/build/build_strategy.py
Outdated
if build_definition.packagetype == ZIP: | ||
for function in build_definition.functions: | ||
if function.name is not single_function_name: | ||
for function in build_definition.functions: | ||
if function.name != single_function_name: | ||
if build_definition.packagetype == ZIP: | ||
# for zip function we need to copy over the artifacts |
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.
Why we need to change the order here? This will check the if
statement for every function in the build definition (no matter it is ZIP
or IMAGE
), but the previous order will have 2 separate flow for IMAGE
and ZIP
from the beginning.
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.
right, good catch! I optimized for more less code. This indeed introduced more checks. Reverted
06788b5
to
c0142f4
Compare
@@ -127,12 +127,18 @@ def build_single_function_definition(self, build_definition: FunctionBuildDefini | |||
# copy results to other functions | |||
if build_definition.packagetype == ZIP: | |||
for function in build_definition.functions: | |||
if function.name is not single_function_name: | |||
if function.name != single_function_name: |
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.
we should use !=
instead of is not
to compare strings.
* Revert "fix: If image functions have same metadata, only 1st one is in the result (#2624)" This reverts commit 9440f15. * Revert "fix: SamFunctionProvider could miss functions with same name but in different stacks (#2609)" This reverts commit 1382eaf. * Revert "fix: Nested stack cannot be extracted if not in working dir (#2618)" This reverts commit d7bcfc6.
…s built
Which issue(s) does this change fix?
Why is this change necessary?
How does it address the issue?
What side effects does this change have?
Checklist
make pr
passesmake update-reproducible-reqs
if dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.