Skip to content

Conversation

@lourens-octopus
Copy link
Contributor

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:
Screenshot 2025-11-11 104709

Deprovision with a name that does not find an exact match:
Screenshot 2025-11-11 104551

Successful deprovision with a name running a runbook:
Screenshot 2025-11-11 104611

Successful deprovision with a name without running a runbook:
Screenshot 2025-11-11 104630

Deprovisioning by selecting from available environments:
Screenshot 2025-11-11 104828
Screenshot 2025-11-11 104844

How to review

Ensure that the command will deprovision and remove an ephemeral environment

Testing

  • Automated tests have been added
  • Manual testing done

Copy link
Contributor

Copilot AI left a 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-environment command supporting both direct and interactive modes
  • Utility function GetByName for 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.

@lourens-octopus lourens-octopus force-pushed the lourens/deprovision-ee-for-project branch 3 times, most recently from 1c5f82a to 461339f Compare November 10, 2025 22:43
@lourens-octopus lourens-octopus requested a review from a team November 10, 2025 22:50
@lourens-octopus lourens-octopus force-pushed the lourens/deprovision-ee-for-project branch 3 times, most recently from c194c1e to 15c47f5 Compare November 11, 2025 03:58
@lourens-octopus lourens-octopus force-pushed the lourens/deprovision-ee-for-project branch from 15c47f5 to 2c28e99 Compare November 11, 2025 04:17
type DeprovisionEnvironmentOptions struct {
*DeprovisionEnvironmentFlags
*cmd.Dependencies
Command *cobra.Command
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

@stevencl840 stevencl840 left a 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

@lourens-octopus lourens-octopus changed the title Deprovision an Ephemeral Environment feat: Deprovision an Ephemeral Environment Nov 11, 2025
@lourens-octopus lourens-octopus merged commit 8d430ef into main Nov 11, 2025
4 checks passed
@lourens-octopus lourens-octopus deleted the lourens/deprovision-ee-for-project branch November 11, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants