-
Notifications
You must be signed in to change notification settings - Fork 14
feat: Deprovision an Ephemeral Environment #562
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new command to deprovision ephemeral environments in the CLI. Users can either specify an environment by name or interactively select from available environments.
Key changes:
- New
deprovision-environmentcommand supporting both direct and interactive modes - Utility function
GetByNamefor finding ephemeral environments with case-insensitive exact matching - Comprehensive test coverage for various scenarios including edge cases
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go |
Core implementation of the deprovision command with prompt handling and output formatting |
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment_test.go |
Test suite covering success cases, error scenarios, and interactive prompting |
pkg/cmd/ephemeralenvironment/util/util.go |
Helper function for finding environments by name with case-insensitive matching |
pkg/cmd/ephemeralenvironment/util/util_test.go |
Tests for the utility function covering various matching scenarios |
pkg/cmd/ephemeralenvironment/ephemeralenvironment.go |
Integration of new command into parent command |
go.mod / go.sum |
Dependency update for go-octopusdeploy library |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Outdated
Show resolved
Hide resolved
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Outdated
Show resolved
Hide resolved
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Outdated
Show resolved
Hide resolved
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Outdated
Show resolved
Hide resolved
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Outdated
Show resolved
Hide resolved
1c5f82a to
461339f
Compare
c194c1e to
15c47f5
Compare
15c47f5 to
2c28e99
Compare
| type DeprovisionEnvironmentOptions struct { | ||
| *DeprovisionEnvironmentFlags | ||
| *cmd.Dependencies | ||
| Command *cobra.Command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I asked for it, but this could be changed back to cmd, if you wanted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I prefer it longer, especially in general go starts complaining about cmd clashing with a package name
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go
Show resolved
Hide resolved
stevencl840
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have worked on this together, and I am pleased with the result. I have left a couple of comments about undoing some changes I had previously asked for
Background
[sc-123004]
We are in the process of adding commands to the CLI to enable a user to manage their ephemeral environments. This PR adds a command to deprovision an ephemeral environment.
Results
A command is added allowing a user to deprovision an ephemeral environment for all projects and remove the environment. The command can be run by passing the Name of the environment to deprovision, or running it in interactive mode where the user can select from all available ephemeral environments to select one to deprovision.
Available Ephemeral Environments:

Deprovision with a name that does not find an exact match:

Successful deprovision with a name running a runbook:

Successful deprovision with a name without running a runbook:

Deprovisioning by selecting from available environments:


How to review
Ensure that the command will deprovision and remove an ephemeral environment
Testing