diff --git a/samcli/commands/pipeline/bootstrap/cli.py b/samcli/commands/pipeline/bootstrap/cli.py index a48cf2f72c..c8fe4c604f 100644 --- a/samcli/commands/pipeline/bootstrap/cli.py +++ b/samcli/commands/pipeline/bootstrap/cli.py @@ -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. """ ), ) diff --git a/samcli/commands/pipeline/bootstrap/guided_context.py b/samcli/commands/pipeline/bootstrap/guided_context.py index 02785c75bd..a7f1f89b08 100644 --- a/samcli/commands/pipeline/bootstrap/guided_context.py +++ b/samcli/commands/pipeline/bootstrap/guided_context.py @@ -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"]), @@ -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: @@ -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}") @@ -231,12 +228,12 @@ 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", @@ -244,6 +241,7 @@ def run(self) -> None: # pylint: disable=too-many-branches 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() diff --git a/samcli/commands/pipeline/init/cli.py b/samcli/commands/pipeline/init/cli.py index 1c1ffc7bb7..bcbe205c6a 100644 --- a/samcli/commands/pipeline/init/cli.py +++ b/samcli/commands/pipeline/init/cli.py @@ -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. """ diff --git a/samcli/commands/pipeline/init/interactive_init_flow.py b/samcli/commands/pipeline/init/interactive_init_flow.py index 9f0f70da88..1dc1e26af6 100644 --- a/samcli/commands/pipeline/init/interactive_init_flow.py +++ b/samcli/commands/pipeline/init/interactive_init_flow.py @@ -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. @@ -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() @@ -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 @@ -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. """ ) ) @@ -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 @@ -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("") diff --git a/samcli/lib/pipeline/bootstrap/stage.py b/samcli/lib/pipeline/bootstrap/stage.py index e1fbdd4d37..7311e86803 100644 --- a/samcli/lib/pipeline/bootstrap/stage.py +++ b/samcli/lib/pipeline/bootstrap/stage.py @@ -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: """ @@ -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:"))