-
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: wrongful IMAGE function options validation (aws#2934) #5729
fix: wrongful IMAGE function options validation (aws#2934) #5729
Conversation
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.
Thanks for following up on this issue after all this time! Left a comment about testing
2b7c9d2
to
42d347d
Compare
Hi there @lucashuy; The I've made adjustments to the unit tests, specifically to the cli_validation, to encompass various scenarios:
These changes could potentially impact the CLI validation behavior across multiple sam commands, notably including |
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.
Thanks for that catch! That is a good call out regarding the other commands that also use this decorator/validation. Since we are still checking if all the Lambdas that are image based, have ECR URLs, I don't imagine that it would be an issue to update with the new method call, however will keep an eye out on the tests.
tests/unit/lib/cli_validation/test_image_repository_validation.py
Outdated
Show resolved
Hide resolved
42d347d
to
ae171c7
Compare
…ons are valid ECR URL (aws#2934)
ae171c7
to
9e3cb87
Compare
validation_function=lambda: not guided | ||
and not image_repositories | ||
and not _is_all_image_funcs_provided(template_file, {}, parameters_overrides) | ||
and not (image_repository or resolve_image_repos), |
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 not to check all parameters in one condition like and not (image_repositories or image_repository or resolve_image_repos)
instead of having them in 2 conditions?
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.
could you please update the existing integration test cases to add a new test cases that cover this issue (a case that all lambda functions have an ECR uri defined in the template, and another case to cover the case if some of the functions has an ECR uri, and some other functions will be provided by sam deploy
parameters
Thanks @alexisfacques for your contribution, please let us know if you need any help to update the code or add integration test cases. |
Closing this PR due to staleness. Please re-open it once you will be able to address the previous comments. Thanks! |
Which issue(s) does this change fix?
Issue #2934
Why is this change necessary?
sam deploy
fails with errorError: Missing option '--image-repositories', '--image-repository', '--resolve-image-repos'
, even when only valid ECRsIMAGE
Lambdas are configured;How does it address the issue?
_is_all_image_funcs_provided
function, which validates that any buildable IMAGE Lambda has a valid ECR location provided; instead of only checking for any IMAGE lambdas in the template.--image-repositories
option is set and no'--image-repository'
or no'--resolve-image-repos'
is set if the_is_all_image_funcs_provided
function returns a falsy resultWhat side effects does this change have?
samconfig
andcli_validation
unit tests;package
,deploy
,sync
(BothZIP
andImage
lambdas);Mandatory Checklist
PRs will only be reviewed after checklist is complete
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.