Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
f12e425
Added ecr_bootstrap
CoshUS Feb 8, 2021
650fe2c
Added companion_stack_manager
CoshUS Feb 11, 2021
5397803
Added Companion Stack Manager
CoshUS Feb 16, 2021
6751928
Added update_companion_stack
CoshUS Feb 17, 2021
6c034ec
Updated companion_stack_builder File Name
CoshUS Feb 18, 2021
f6204af
Formatted with Black
CoshUS Feb 18, 2021
13b425f
Updated get_unreferenced_repos
CoshUS Mar 1, 2021
25d2dad
Updated guided_context to Use Companion Stack
CoshUS Mar 1, 2021
fbe5a66
Added Delete Auto Create ECR Repo Prompt
CoshUS Mar 1, 2021
0b9a881
Updated prompt_image_repository Flow
CoshUS Mar 1, 2021
676fa01
Added --resolve-image-repos
CoshUS Mar 4, 2021
2e16290
Addressed Some of Pylint Issues
CoshUS Mar 4, 2021
739b550
Updated Helper Text
CoshUS Apr 14, 2021
c48e07d
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 14, 2021
701932c
Updated Comments
CoshUS Apr 14, 2021
f1f9f45
Fixed Typing
CoshUS Apr 14, 2021
b82d544
Removed Unused Imports
CoshUS Apr 14, 2021
2d2cf5b
Updated Unit Tests
CoshUS Apr 15, 2021
9fb143e
Updated UX and Fixed Windows ANSI
CoshUS Apr 15, 2021
f015829
Updated Unit Tests
CoshUS Apr 16, 2021
cdef3a6
Fixed Import Order
CoshUS Apr 16, 2021
23576c3
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 16, 2021
6dd8c67
Added Ignore Import Check
CoshUS Apr 16, 2021
addd5a1
Added Integration Tests
CoshUS Apr 16, 2021
92002d4
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 16, 2021
edf778d
Updated help text.
CoshUS Apr 16, 2021
f8244a4
Added Comments for Name Generation
CoshUS Apr 16, 2021
0214950
Updated Image Option Validator
CoshUS Apr 19, 2021
7b5a46c
Updated CompanionStackBuilder to Use Dict instead of String
CoshUS Apr 19, 2021
c6f2698
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 19, 2021
5edd495
Fixed Argument Ordering
CoshUS Apr 23, 2021
7b3572e
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 23, 2021
9ffd4bd
Added Mapping Information to Help Text
CoshUS Apr 26, 2021
a83f7fc
Merge branch 'feat/auto-ecr' of https://github.com/CoshUS/aws-sam-cli…
CoshUS Apr 26, 2021
79ef739
Updated delete_unreferenced_repos Doc String
CoshUS Apr 26, 2021
90b5b4c
Updated sync_repos Doc String
CoshUS Apr 26, 2021
4157cb9
Added Justification for ECR Repo Physical ID
CoshUS Apr 26, 2021
5d84813
Refactored to be Less Coupled
CoshUS Apr 26, 2021
ce355cf
Refactored for prompt_specify_repos
CoshUS Apr 26, 2021
366b7f7
Fixed Unit Test
CoshUS Apr 26, 2021
c653dff
Moved WaiterConfig Out of Methods
CoshUS Apr 26, 2021
4be0e11
Updated Typing
CoshUS Apr 26, 2021
c18ad41
Updated Managed S3 Template to be Dict
CoshUS Apr 26, 2021
191309a
Fixed Typo
CoshUS Apr 26, 2021
bfdf4a7
Added Comments for _save_image_repositories
CoshUS Apr 26, 2021
e03c48a
Fixed Pylint Issue
CoshUS Apr 26, 2021
b016b14
Merge branch 'develop' into feat/auto-ecr
CoshUS Apr 26, 2021
85ced27
Added Missing Check for unreferenced_repo_uris
CoshUS Apr 27, 2021
6c3f54a
Merge branch 'feat/auto-ecr' of https://github.com/CoshUS/aws-sam-cli…
CoshUS Apr 27, 2021
1946945
Merge branch 'develop' into feat/auto-ecr
mgrandis May 3, 2021
7693d9a
Updated Variable Name
CoshUS May 4, 2021
6393418
Fixed Typo
CoshUS May 4, 2021
7411f9f
Updated Windows Check to Use platform.system()
CoshUS May 4, 2021
f3b5bcb
Updated update_companion_stack Logic
CoshUS May 4, 2021
3039f18
Merge branch 'feat/auto-ecr' of https://github.com/CoshUS/aws-sam-cli…
CoshUS May 4, 2021
3575581
Fixed Comment Typo
CoshUS May 4, 2021
17a7a41
Fixed Typos
CoshUS May 4, 2021
8a1c458
Fixed Test Name
CoshUS May 4, 2021
c4e9632
Merge branch 'develop' into feat/auto-ecr
CoshUS Jul 12, 2021
b29a3c5
Added Refactor TODO
CoshUS Jul 27, 2021
e86f9f0
Refactored Out CompanionStackManagerHelper
CoshUS Jul 28, 2021
be2cc4c
Refactored Out Single Variable
CoshUS Jul 28, 2021
3d65f52
Fixed PyLint Issues
CoshUS Jul 28, 2021
707bc18
Fixed Typos
CoshUS Jul 28, 2021
06c5042
Merge branch 'develop' into feat/auto-ecr
CoshUS Jul 28, 2021
ad6a92b
Fixed Unit Tests
CoshUS Jul 29, 2021
8500d7b
Added More Tests to CompanionStackManager
CoshUS Jul 29, 2021
dae09ee
Merge branch 'develop' into feat/auto-ecr
CoshUS Jul 29, 2021
aa370fd
Formatted with Black
CoshUS Jul 29, 2021
4005170
Fixed Integration Tests
CoshUS Jul 29, 2021
9a1261a
Fixed PyLint Issue
CoshUS Jul 29, 2021
f7fbdf0
Added Image Repository Mapping Echo
CoshUS Jul 30, 2021
17915ba
Added str_checksum and Cutoff Tests
CoshUS Jul 30, 2021
778b4e8
Added Debug Logs and Some Refactoring
CoshUS Jul 30, 2021
e8f06e2
Merge branch 'develop' into feat/auto-ecr
CoshUS Jul 30, 2021
9be8161
Added More Resource Info to Debug Logs
CoshUS Jul 30, 2021
829695a
Fixed Unit Tests
CoshUS Jul 30, 2021
d20cce6
Updated delete_companion_stack to Protected
CoshUS Aug 10, 2021
92e71c2
Updated Parameter Validation
CoshUS Aug 10, 2021
bf963cc
Fixed Validation Logic
CoshUS Aug 10, 2021
13d5bb5
Fixed Unit Tests
CoshUS Aug 10, 2021
1f52b26
Merge branch 'develop' into feat/auto-ecr
CoshUS Aug 19, 2021
4a97075
Merge branch 'develop' into feat/auto-ecr
CoshUS Aug 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions samcli/commands/deploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from samcli.lib.utils import osutils
from samcli.lib.bootstrap.bootstrap import manage_stack
from samcli.lib.utils.version_checker import check_newer_version
from samcli.lib.bootstrap.companion_stack.companion_stack_manager import sync_ecr_stack

SHORT_HELP = "Deploy an AWS SAM application."

Expand Down Expand Up @@ -158,6 +159,14 @@
"If you do not provide a --s3-bucket value, the managed bucket will be used. "
"Do not use --s3-guided parameter with this option.",
)
@click.option(
"--resolve-image-repos",
required=False,
is_flag=True,
help="Automatically create and delete ECR repositories for image-based functions in non-guided deployments. "
"A companion stack containing ECR repos for each function will be deployed along with the template stack. "
"Automatically created image repositories will be deleted if the corresponding functions are removed.",
)
@metadata_override_option
@notification_arns_override_option
@tags_override_option
Expand Down Expand Up @@ -196,6 +205,7 @@ def cli(
confirm_changeset,
signing_profiles,
resolve_s3,
resolve_image_repos,
config_file,
config_env,
):
Expand Down Expand Up @@ -230,6 +240,7 @@ def cli(
resolve_s3,
config_file,
config_env,
resolve_image_repos,
) # pragma: no cover


Expand Down Expand Up @@ -260,6 +271,7 @@ def do_cli(
resolve_s3,
config_file,
config_env,
resolve_image_repos,
):
"""
Implementation of the ``cli`` method
Expand Down Expand Up @@ -289,13 +301,21 @@ def do_cli(
config_file=config_file,
)
guided_context.run()
elif resolve_s3 and bool(s3_bucket):
raise DeployResolveS3AndS3SetError()
elif resolve_s3:
s3_bucket = manage_stack(profile=profile, region=region)
click.echo(f"\n\t\tManaged S3 bucket: {s3_bucket}")
click.echo("\t\tA different default S3 bucket can be set in samconfig.toml")
click.echo("\t\tOr by specifying --s3-bucket explicitly.")
else:
if resolve_s3:
if bool(s3_bucket):
raise DeployResolveS3AndS3SetError()
s3_bucket = manage_stack(profile=profile, region=region)
click.echo(f"\n\t\tManaged S3 bucket: {s3_bucket}")
click.echo("\t\tA different default S3 bucket can be set in samconfig.toml")
click.echo("\t\tOr by specifying --s3-bucket explicitly.")

# TODO Refactor resolve-s3 and resolve-image-repos into one place
# after we figure out how to enable resolve-images-repos in package
if resolve_image_repos:
image_repositories = sync_ecr_stack(
template_file, stack_name, region, s3_bucket, s3_prefix, image_repositories
)

with osutils.tempfile_platform_independent() as output_template_file:

Expand Down
5 changes: 4 additions & 1 deletion samcli/commands/deploy/guided_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def _save_parameter_overrides(self, cmd_names, config_env, parameter_overrides,
samconfig.put(cmd_names, self.section, "parameter_overrides", " ".join(_params), env=config_env)

def _save_image_repositories(self, cmd_names, config_env, samconfig, image_repositories):
if image_repositories:
# Check for None only as empty dict should be saved to config
# This can happen in an edge case where all companion stack repos are deleted and
# the config needs to be updated.
if image_repositories is not None:
_image_repositories = [f"{key}={value}" for key, value in image_repositories.items()]
samconfig.put(cmd_names, self.section, "image_repositories", _image_repositories, env=config_env)

Expand Down
Loading