-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Add ephemeral environment create command #559
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
| const ( | ||
| FlagName = "name" | ||
| FlagProject = "project" | ||
| ) |
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.
No need for a --space flag as this is automatically added to the command.
676bb4b to
2e51397
Compare
| @@ -0,0 +1,67 @@ | |||
| package create_test | |||
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.
These are based on the test to create a space.
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 support for managing ephemeral environments in Octopus Deploy through a new ephemeral-environment CLI command with a create subcommand.
- Introduces a new
ephemeral-environmentcommand group with acreatesubcommand - Updates the
go-octopusdeploydependency to versionv2.85.2-0.20251102214655-01f4f4d03e21to support ephemeral environments API - Implements interactive prompting and validation for ephemeral environment creation with project association
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/root/root.go | Registers the new ephemeral environment command in the CLI root |
| pkg/cmd/ephemeralenvironment/ephemeralenvironment.go | Defines the ephemeral-environment command group and metadata |
| pkg/cmd/ephemeralenvironment/create/create.go | Implements the create subcommand with flags, prompts, and API integration |
| pkg/cmd/ephemeralenvironment/create/create_test.go | Tests for the create command's interactive prompting behavior |
| go.mod | Updates go-octopusdeploy dependency to support ephemeral environments |
| go.sum | Checksums for the updated dependency |
Comments suppressed due to low confidence (1)
go.mod:3
- Go version 1.23.12 does not exist. The latest Go 1.23.x release as of January 2025 is 1.23.4. This appears to be an invalid version number.
go 1.23.12
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2e51397 to
7c9ed99
Compare
188921f to
9bcbe23
Compare
| } | ||
|
|
||
| if opts.Project.Value == "" { | ||
| project, err := selectors.Select(opts.Ask, "Select an ephemeral environments configured project to associate with the environment:", opts.GetConfiguredProjectsCallback, func(project *projects.Project) string { return project.GetName() }) |
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.
The wording here is a bit awkward, The test sentence feels like the subject is a bit backward (sorry I am not sure how to explain the feeling). Maybe something like "Select a project that has been configured for ephemeral environments, to create your new environment in:"
Or could we take this to the team for input?
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.
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.
To code looks good. I have tested both prompted and unprompted
2bb68ee to
73469ed
Compare

Background 🌇
Ephemeral environments allow users to quickly and automatically spin up and tear down environments with consistent settings in Octopus. To make ephemeral environments a first class experience, we want to support interaction with ephemeral environments via the Octopus portal, API, GitHub Actions and the CLI.
What's this? 🌵
This PR adds our first CLI command for ephemeral environments, to enable users to create a new ephemeral environment.
The command requires the following inputs:
--name)--project)--space)When the command is run in non-interactive mode, values for
name,spaceandprojectmust be provided using the flags shown above.When the command is run in interactive mode, prompts will appear if values are not provided for
nameandproject.❓ In interactive mode, a value for space should be supplied using the
OCTOPUS_SPACEenvironment variable. (Or using the--spaceflag.) It's not in the spec but would we like to have a prompt to select a space in interactive mode as well??⬇️
Update: As discussed with @geofflamrock and confirmed with a click around the other create commands, we generally do not prompt for a space input. So no need to do it here 👍
Testing 🧪
The following cases have been tested:
✅ Create an EE with non interactive mode
✅ Create an EE in interactive mode with the
OCTOPUS_SPACEenvironment variable✅ Create an EE in interactive mode with the
--spaceflag set✅ Show only EE configured projects in interactive mode if the space contains unconfigured projects
☑️ Throw an informative error in interactive mode if the space contains no configured projects
☑️ Throw server error if an EE of the same name already exists with a different parent environment
☑️ Throw server error if an EE of the same name is already connected to the project
How to review? 🔍
☑️ Code quality - this is my first contribution to the CLI and my first crack at writing in Go, so please check carefully.
❓ Do we want to have a prompt to select the space as well?Fixes[sc-123001]