fix: wrongful IMAGE function options validation (aws#2934)#5729
fix: wrongful IMAGE function options validation (aws#2934)#5729alexisfacques wants to merge 1 commit intoaws:developfrom
Conversation
lucashuy
left a comment
There was a problem hiding this comment.
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 |
lucashuy
left a comment
There was a problem hiding this comment.
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.
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?
moelasmar
left a comment
There was a problem hiding this comment.
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 deployfails with errorError: Missing option '--image-repositories', '--image-repository', '--resolve-image-repos', even when only valid ECRsIMAGELambdas are configured;How does it address the issue?
_is_all_image_funcs_providedfunction, 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-repositoriesoption is set and no'--image-repository'or no'--resolve-image-repos'is set if the_is_all_image_funcs_providedfunction returns a falsy resultWhat side effects does this change have?
samconfigandcli_validationunit tests;package,deploy,sync(BothZIPandImagelambdas);Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.