Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion samcli/commands/pipeline/bootstrap/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def do_cli(
sam pipeline bootstrap generates the necessary AWS resources to connect a stage in
your CI/CD system. We will ask for [1] stage definition, [2] account details, and
[3] references to existing resources in order to bootstrap these pipeline
resources. You can also add optional security parameters.
resources.
"""
),
)
Expand Down
18 changes: 8 additions & 10 deletions samcli/commands/pipeline/bootstrap/guided_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def _prompt_account_id(self) -> None:
)
)
has_env_creds = os.getenv(EnvProvider.ACCESS_KEY) and os.getenv(EnvProvider.SECRET_KEY)
click.echo(f" 1. Environment variables{' (not available)' if not has_env_creds else ''}")
click.echo(f"\t1 - Environment variables{' (not available)' if not has_env_creds else ''}")
for i, profile in enumerate(profiles):
click.echo(f" {i + 2}. {profile} (named profile)")
click.echo(" q. Quit and configure AWS credential myself")
click.echo(f"\t{i + 2} - {profile} (named profile)")
click.echo("\tq - Quit and configure AWS credentials")
answer = click.prompt(
"Select an account source to associate with this stage",
"Select a credential source to associate with this stage",
show_choices=False,
show_default=False,
type=click.Choice((["1"] if has_env_creds else []) + [str(i + 2) for i in range(len(profiles))] + ["q"]),
Expand All @@ -78,7 +78,7 @@ def _prompt_account_id(self) -> None:
account_id = get_current_account_id(self.profile)
click.echo(self.color.green(f"Associated account {account_id} with stage {self.stage_name}."))
except CredentialsError as ex:
click.echo(self.color.red(ex.message))
click.echo(f"{self.color.red(ex.message)}\n")
self._prompt_account_id()

def _prompt_stage_name(self) -> None:
Expand Down Expand Up @@ -210,19 +210,16 @@ def run(self) -> None: # pylint: disable=too-many-branches
click.echo(f"Pipeline execution role ARN: {self.pipeline_execution_role_arn}")
else:
self._prompt_pipeline_execution_role()
click.echo()

if self.cloudformation_execution_role_arn:
click.echo(f"CloudFormation execution role ARN: {self.cloudformation_execution_role_arn}")
else:
self._prompt_cloudformation_execution_role()
click.echo()

if self.artifacts_bucket_arn:
click.echo(f"Artifacts bucket ARN: {self.cloudformation_execution_role_arn}")
else:
self._prompt_artifacts_bucket()
click.echo()

if self.image_repository_arn:
click.echo(f"ECR image repository ARN: {self.image_repository_arn}")
Expand All @@ -231,19 +228,20 @@ def run(self) -> None: # pylint: disable=too-many-branches
click.echo()

# Ask customers to confirm the inputs
click.secho(self.color.bold("[5] Summary"))
click.secho(self.color.bold("[4] Summary"))
while True:
inputs = self._get_user_inputs()
click.secho("Below is the summary of the answers:")
for i, (text, _) in enumerate(inputs):
click.secho(f" {i + 1}. {text}")
click.secho(f"\t{i + 1} - {text}")
edit_input = click.prompt(
text="Press enter to confirm the values above, or select an item to edit the value",
default="0",
show_choices=False,
show_default=False,
type=click.Choice(["0"] + [str(i + 1) for i in range(len(inputs))]),
)
click.echo()
if int(edit_input):
inputs[int(edit_input) - 1][1]()
click.echo()
Expand Down
4 changes: 2 additions & 2 deletions samcli/commands/pipeline/init/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

SHORT_HELP = "Generates CI/CD pipeline configuration files."
HELP_TEXT = """
sam pipeline init generates a pipeline config file that you can use to connect your
sam pipeline init generates a pipeline configuration file that you can use to connect your
AWS account(s) to your CI/CD system. Before using sam pipeline init, you must
bootstrap the necessary resources for each stage in your pipeline. You can do this
by running sam pipeline init --bootstrap to be guided through the setup and config
by running sam pipeline init --bootstrap to be guided through the setup and configuration
file generation process, or refer to resources you have previously created with the
sam pipeline bootstrap command.
"""
Expand Down
15 changes: 8 additions & 7 deletions samcli/commands/pipeline/init/interactive_init_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def do_interactive(self) -> None:
dedent(
"""\

sam pipeline init generates a pipeline config file that you can use to connect your
sam pipeline init generates a pipeline configuration file that you can use to connect your
AWS account(s) to your CI/CD system. We will guide you through the process to
bootstrap resources for each stage, then walk through the details necessary for
creating the pipeline config file.
Expand Down Expand Up @@ -84,7 +84,7 @@ def _generate_from_app_pipeline_templates(
"""
Prompts the user to choose a pipeline template from SAM predefined set of pipeline templates hosted in the git
repository: aws/aws-sam-cli-pipeline-init-templates.git
downloads locally, then generates the pipeline config file from the selected pipeline template.
downloads locally, then generates the pipeline configuration file from the selected pipeline template.
Finally, return the list of generated files.
"""
pipeline_templates_local_dir: Path = _clone_app_pipeline_templates()
Expand Down Expand Up @@ -144,7 +144,7 @@ def _prompt_run_bootstrap_within_pipeline_init(self, stage_names: List[str], req

For each stage, we will ask for [1] stage definition, [2] account details, and [3]
reference application build resources in order to bootstrap these pipeline
resources. You can also add optional security parameters.
resources.

We recommend using an individual AWS account profiles for each stage in your
pipeline. You can set these profiles up using [little bit of info on how to do
Expand Down Expand Up @@ -175,10 +175,10 @@ def _prompt_run_bootstrap_within_pipeline_init(self, stage_names: List[str], req
click.echo(
Colored().yellow(
dedent(
f"""\
"""\
If you want to setup stages before proceed, please quit the process using Ctrl+C.
Then you can either run {Colored().bold('sam pipeline bootstrap')} to setup a stage
or re-run this command with option {Colored().bold('--bootstrap')} to enable stage setup.
Then you can either run 'sam pipeline bootstrap' to setup a stage
or re-run this command with option '--bootstrap' to enable stage setup.
"""
)
)
Expand All @@ -195,7 +195,7 @@ def _generate_from_pipeline_template(self, pipeline_template_dir: Path) -> List[
click.echo(f"You are using the {required_env_number}-stage pipeline template.")
_draw_stage_diagram(required_env_number)
while True:
click.echo("Checking for bootstrapped resources...")
click.echo("Checking for bootstrapped resources...\n")
stage_names, bootstrap_context = _load_pipeline_bootstrap_resources()
if len(stage_names) < required_env_number and self._prompt_run_bootstrap_within_pipeline_init(
stage_names, required_env_number
Expand Down Expand Up @@ -432,3 +432,4 @@ def _draw_stage_diagram(number_of_stages: int) -> None:
stage_lines = [_lines_for_stage(i + 1) for i in range(number_of_stages)]
for i, delimiter in enumerate(delimiters):
click.echo(delimiter.join([stage_lines[stage_i][i] for stage_i in range(number_of_stages)]))
click.echo("")
4 changes: 2 additions & 2 deletions samcli/lib/pipeline/bootstrap/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _get_non_user_provided_resources_msg(self) -> str:
else [self.image_repository.comment],
]
)
return "\n".join([f" - {comment}" for comment in resource_comments])
return "\n".join([f"\t- {comment}" for comment in resource_comments])

def bootstrap(self, confirm_changeset: bool = True) -> bool:
"""
Expand Down Expand Up @@ -316,7 +316,7 @@ def print_resources_summary(self) -> None:
if created_resources:
click.secho(self.color.green("The following resources were created in your account:"))
for resource in created_resources:
click.secho(self.color.green(f" - {resource.comment}"))
click.secho(self.color.green(f"\t- {resource.comment}"))

if not self.pipeline_user.is_user_provided:
click.secho(self.color.green("Pipeline IAM user credential:"))
Expand Down