Skip to content
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

pipeline delete experience #630

Closed
SoManyHs opened this issue Jan 30, 2020 · 8 comments · Fixed by #652 · May be fixed by Tipser/copilot-cli#60 or thisguy726/copilot-cli#160
Closed

pipeline delete experience #630

SoManyHs opened this issue Jan 30, 2020 · 8 comments · Fixed by #652 · May be fixed by Tipser/copilot-cli#60 or thisguy726/copilot-cli#160
Assignees
Labels
area/pipeline Issues about pipelines to release applications. type/design Issues that are design proposals.

Comments

@SoManyHs
Copy link
Contributor

SoManyHs commented Jan 30, 2020

Experience

Help menu

$ ecs-preview pipeline delete -h
Deletes given pipeline from your project

Usage
   ecs-preview pipeline delete ... [flags]

Flags
  -h, --help               help for init
      --yes                Skips deletion confirmation prompt (default false).
     --delete-secret  Deletes SecretsManager secret that stores the auth token associated with the source stage of the pipeline (default false).

Global Flags
  -p, --project string   Name of the project.

Examples
  Delete the pipeline associated with your project.
  `$ archer pipeline delete `

  Delete the pipeline associated with your project without prompting
  `$ archer pipeline delete --yes --delete-secret`

The interactive experience

$ archer pipeline delete
? Are you sure you want to delete the pipeline associated with this project? [y/N] y
? Would you like to delete the secret <secret_name> associated with this pipeline? [y/N] y
⠼ Deleting stored secret <secret_name>.

Errors

If the pipeline has active builds in progress.

$ archer env delete test --yes
Error: There is currently an active build for pipeline <name>. Please try again when build is finished.

If there is no pipeline.yml in the project.

$ archer pipeline delete --yes
Error: no pipeline associated in project <project_name>.

Follow-up steps

Display progress of deletions just like in env delete.

@SoManyHs SoManyHs self-assigned this Jan 30, 2020
@SoManyHs SoManyHs added type/design Issues that are design proposals. area/pipeline Issues about pipelines to release applications. labels Jan 30, 2020
@bvtujo
Copy link
Contributor

bvtujo commented Jan 30, 2020

Does it make sense to have a separate flag to delete without confirmation but retain the secret? The use cases seem like the following:

  1. I naively call pipeline delete because I haven't yet had to think about the particulars of how this method workds
  2. I call pipeline delete --yes because I know I want to delete everything but am going to redeploy a pipeline immediately
  3. I call pipeline delete --yes and want to delete everything, I'm done with it.

In 2. is there a chance that I'll stop myself from being able to deploy pipelines with the same Github token for 7 days until the secret fully goes away? Does the possible user confusion from case 2 warrant complexity of an extra flag?

@efekarakus
Copy link
Contributor

:shipit:

@bvtujo we could bypass the 7 days wait I believe with the ForceDeleteWithoutRecovery parameter https://docs.aws.amazon.com/sdk-for-go/api/service/secretsmanager/#DeleteSecretInput

@bvtujo
Copy link
Contributor

bvtujo commented Jan 30, 2020

@efekarakus that's good, I think that's my only issue here. As long as we definitely destroy the token when the user specifies --yes then :shipit:

@kohidave
Copy link
Contributor

Yay! Thanks for this design. Just curious, why stop if there's an active build? Will CF yell at us if we try to delete a CodeBuild project that has an active build?

@SoManyHs
Copy link
Contributor Author

@kohidave not sure. The original thought was that it might leave an environment in a weird state, but I can double check what the CFN behavior is. Do you think it's a better experience to just delete anyway if there's a build going?

@SoManyHs
Copy link
Contributor Author

SoManyHs commented Feb 1, 2020

Addresses #626

@SoManyHs
Copy link
Contributor Author

SoManyHs commented Feb 4, 2020

Do we want to specify --app as a flag, in case a project has multiple pipelines?

@SoManyHs
Copy link
Contributor Author

SoManyHs commented Feb 4, 2020

Just kidding, ideally we expect only one pipeline.yml file per workspace.

SoManyHs added a commit to SoManyHs/copilot-cli that referenced this issue Feb 12, 2020
SoManyHs added a commit to SoManyHs/copilot-cli that referenced this issue Feb 14, 2020
SoManyHs added a commit to SoManyHs/copilot-cli that referenced this issue Feb 14, 2020
SoManyHs added a commit that referenced this issue Feb 17, 2020
* Delete pipeline

Closes #630

* Remove unused method

This was leftover from a refactor in which we moved much of the PreRunE
logic into the constructor for the opts. This approach allows for ease
and consistency of testing.

NOTE: See 16d3bb1 -- previously, calling the constructors outside of
RunE made it harder to catch errors returned by the constructor itself.
This allows the errors to be caught will still getting values from the
command's flags..

* Move PipelineName and PipelineSecret into opts

Neither field will be passed in as flags, so they can be moved out of
deletePipelineVars.

* Wrap error from secretsmanager.DeleteSecret

* remove PipelineFilename from initPipelineVars

Since we always assume the pipeline for a workspace will be named
"pipeline.yml", we are not passing this field in as a flag.

* delete pipeline file - placeholder

pending changes in #657

* Force delete the pipeline secret

* Add tag for secret

* Delete pipeline manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pipeline Issues about pipelines to release applications. type/design Issues that are design proposals.
Projects
None yet
4 participants