-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add --resolve-image-repos support to sam package #8476
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
base: develop
Are you sure you want to change the base?
feat: add --resolve-image-repos support to sam package #8476
Conversation
Implements issue aws#3888 to auto-create ECR repositories during packaging, matching sam deploy behavior. Enables package-once, deploy-many CI/CD workflows with managed ECR repos. - Add --resolve-image-repos CLI option to sam package - Call sync_ecr_stack() to auto-create managed ECR repositories - Add validation requiring --s3-bucket when flag is used - Add conflict detection with --image-repositories - Add unit tests for validation logic Closes aws#3888
vicheey
left a comment
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.
Thank you for your contribution. Since this is a remote operation, do you mind add integration test as well.
| super().__init__(message=message_fmt) | ||
|
|
||
|
|
||
| class PackageResolveImageReposAndImageReposSetError(UserException): |
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.
I do not see this class being used anywhere.
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.
Ah!, my apologies I implemented this class to check exceptions in my testing, but I haven't included my testing files in here so the reason why this class is unused in the PR.
| Execute packaging based on the argument provided by customers and samconfig.toml. | ||
| """ | ||
| if self.resolve_image_repos: | ||
| from samcli.lib.bootstrap.companion_stack.companion_stack_manager import sync_ecr_stack |
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.
Following the existing pattern, the import should be at the top of the file.
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.
I have updated this PR now, and made this above change. I have also added the integration tests with this update.
…add integration test
Summary
Implements
--resolve-image-repossupport forsam packagecommand to automatically create ECR repositories, matching the behavior ofsam deploy.Resolves
Closes #3888
Changes
--resolve-image-reposCLI option tosam packagesync_ecr_stack()to auto-create managed ECR repositories--s3-bucketwhen flag is used--image-repositoriesTesting
Use Case
Enables CI/CD workflows to package once and deploy to multiple environments in parallel using AWS-managed ECR repositories, avoiding manual repo creation and permission complexity.