uselagoon / uselagoon/lagoon-cli

"Delete environment" command should fail without both project and environment parameters

Open
#149 2 comments 0 reactions 1 assignee View on GitHub

@shreddedbacon is already working on this.

Since Aug 22, 2020.

Dominant language
Go
Stars
28
Forks
14
Avg merge
1d 2h
Merged PRs (30d)
1

Description

Describe the bug
Running lagoon delete environment without specifying both project and environment auto-selects one or both based on your current working directory, and attempts to proceed with a deletion. (i.e. shows a confirmation dialog. I haven't tested with --force.)

To Reproduce
Steps to reproduce the behaviour:

  1. Navigate to a lagoon-enabled repository
  2. Run one of:
    • lagoon delete environment
    • lagoon -p project-name delete environment
    • lagoon -e environment-name delete environment
  3. The cli offers to delete an environment, but not necessarily the one you intend
    • project appears to pull from the file specified by 'docker-compose-yaml' in .lagoon.yml
    • environment seems to use the current git branch name, even if there is no matching environment in a project

Expected behaviour
Unless both project and environment are explicitly provided, a high-impact command like delete should fail fast with a suitable usage message. Making any assumptions based on the current working directory is risky in this context.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux
  • Browser: N/A
  • Version: lagoon 0.9.2 (go version go1.13.12 linux/amd64)

Additional context
As a related side note, the lagoon delete environment syntax feels like it could/should take the target as a direct parameter, e.g.:
lagoon -p project-name delete environment environment-name

That's what I first tried ― no error was thrown, but the environment was selected incorrectly. (Leading to this report.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.