Skip to content

Conversation

@caitlynstocker
Copy link
Contributor

@caitlynstocker caitlynstocker commented Nov 6, 2025

Background 🌇

As part of our setup to support ephemeral environments, we have added a DeploymentEnvironmentV2 environment type which encompasses static deployment environments, parent environments and ephemeral environments.

Our existing environmentRepository's list function returns a list of the old DeploymentEnvironment type representing only static deployment environments.

What's this? 🌵

This PR adds a environmentsV2Repository to work with the DeploymentEnvironmentV2 type. At the moment, the only functionality we need from the new repository is a list endpoint.

🚩 The environmentRepository also contains a few functions for working with the DeploymentEnvironmentV2. However a new repository is required to add functions which environmentRepository inherits from SpaceScopedBasicRepository such as list, create, del, etc. as these are all set up to return only the old environment type. (And changing these would be a huge breaking change.)

Testing 🧪

When tested on a cloud instance using the deploy-release-action (the requirements of which inspired this change) the new list function successfully returned a list of environments including ephemeral environments.

When tested locally using the example file, the new list function returned items of all three environment types.

How to review? 🔍

☑️ Anything I've missed?

Fixes[sc-127375]

ids?: string[];
partialName?: string;
skip: number;
take: number;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the skip and take values required as they're required on the v2 endpoint.

@caitlynstocker caitlynstocker changed the title Cat/update env repo for ephemeral envs Add environmentV2 repository to list new environment types Nov 6, 2025
@caitlynstocker caitlynstocker changed the title Add environmentV2 repository to list new environment types fix: Add environmentV2 repository to list new environment types Nov 6, 2025
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 introduces a new EnvironmentV2Repository class to support querying deployment environments using the v2 API endpoint, and includes an example demonstrating its usage.

  • Added EnvironmentV2Repository class with a list method to query environments via the v2 API endpoint
  • Exported the new repository from the deploymentEnvironments module
  • Created an example script showing how to use the new repository

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/features/deploymentEnvironments/index.ts Exports the new EnvironmentV2Repository class
src/features/deploymentEnvironments/environmentV2Repository.ts Implements the new repository class for v2 API endpoint
examples/src/environments/get-environments.ts Demonstrates usage of the new repository

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@caitlynstocker caitlynstocker force-pushed the cat/update-env-repo-for-ephemeral-envs branch from acc9024 to 4ad2f1c Compare November 6, 2025 05:32
@OctopusDeploy OctopusDeploy deleted a comment from Copilot AI Nov 6, 2025
@caitlynstocker caitlynstocker force-pushed the cat/update-env-repo-for-ephemeral-envs branch from 4ad2f1c to c7b3cdc Compare November 6, 2025 05:35
@caitlynstocker caitlynstocker marked this pull request as ready for review November 6, 2025 06:20
Copy link
Contributor

@geofflamrock geofflamrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one thought for completeness of the environments v2 api but doesn't need a re-review unless you would like it.

@@ -0,0 +1,25 @@
import { Client, DeploymentEnvironmentV2, ResourceCollection, spaceScopedRoutePrefix } from "../..";

type EnvironmentV2RepositoryListArgs = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v2 endpoint supports optional filtering by an array of environment types using the type property, for completeness it's prob worth adding that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea :)

@caitlynstocker caitlynstocker merged commit 55f76ba into main Nov 6, 2025
5 checks passed
@caitlynstocker caitlynstocker deleted the cat/update-env-repo-for-ephemeral-envs branch November 6, 2025 06:54
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