Skip to content

feat: Add GitHub Action to deprovision an ephemeral environment#4

Merged
caitlynstocker merged 7 commits intomainfrom
cat/124036/add-deprovisioning-action
Oct 30, 2025
Merged

feat: Add GitHub Action to deprovision an ephemeral environment#4
caitlynstocker merged 7 commits intomainfrom
cat/124036/add-deprovisioning-action

Conversation

@caitlynstocker
Copy link
Copy Markdown
Contributor

@caitlynstocker caitlynstocker commented Oct 29, 2025

What's this? 🐕

This adds a first iteration of our Octopus GitHub action to deprovision an ephemeral environment.

Action inputs:

  • Name of the EE to deprovision
  • Name of the space containing the project
  • Server URL
  • API key

Values for space name, server URL and API key (or OIDC access key) can also be supplied using environment variables. In the case where an input and env var are both provided, the environment variables takes precedence.

Action outputs:

The action outputs a JSON string containing a runbookRunId and serverTaskId for each deprovisioning runbook run. This is consistent with the format we use in the create-runbook-run GitHub Action which outputs a JSON string of objects containing a serverTaskId, environmentId and tenantId.

By outputting the serverTaskId, we enable users to wait for their deprovisioning tasks to run using the await-task GitHub Action.

Test workflow

This change includes a test workflow which can be run manually from the Actions tab of this repository. It takes the same inputs as the action listed about. If login information is not supplied to the test workflow, it defaults to using the team-github test instance. The server URL and OIDC service account Id for the test instance are stored on the repo as a repository secret and variable.

🚩 Currently the default OIDC identity details used by the action are pointing to this branch.

  • TODO: Update the default OIDC identity to point to the main branch after merging.

Testing 🧪

The workflow included with this action was tested using the freshly updated team-github test instance. Feel free to try it out yourself!

The action has been tested using both OIDC login (as per the test workflow) and API-keys.

How to review? 🔍

✔️ Code quality
🧪 To test, create an EE and provide the name when running the 'Test Deprovision Environment' workflow. If using an instance other than the one linked above, you will need to provide an instance URL and API-key/ service account.

Fixes[sc-124036]

with:
server: ${{ inputs.server || vars.TEST_INSTANCE_URL }}
service_account_id: ${{ inputs.service_account_id || vars.TEST_INSTANCE_SERVICE_ACCOUNT_ID }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It could be nice if we could add a step in here which creates an EE and waits for it to deploy.

But we would need to output the provisioning and deployment server task ids from the create action so we could wait for them to complete...

Copy link
Copy Markdown
Contributor

@stevencl840 stevencl840 Oct 30, 2025

Choose a reason for hiding this comment

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

Actually, not so much. The environment is created, but it is not provisioned or deployed at this time. When you manually create a deployment, the provisioning is kicked off. So, waiting for the deployment server task to complete would be enough

Copy link
Copy Markdown
Contributor Author

@caitlynstocker caitlynstocker Oct 30, 2025

Choose a reason for hiding this comment

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

Oh yeah, true. Just the deployment task id then. But I don't think we can access it here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You would need to create a release and deployment using those actions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a job for our future selves 🔮✨

@shortcut-integration
Copy link
Copy Markdown

This pull request has been linked to Shortcut Story #124036: Support deprovisioning an entire ephemeral environment.

@caitlynstocker caitlynstocker changed the title Cat/124036/add deprovisioning action feat: Add GitHub Action to deprovision an ephemeral environment Oct 29, 2025
@caitlynstocker caitlynstocker force-pushed the cat/124036/add-deprovisioning-action branch from a90f597 to b7375e4 Compare October 29, 2025 06:26
@caitlynstocker caitlynstocker marked this pull request as ready for review October 29, 2025 06:40
@@ -1,4 +1,42 @@
name: Test Deprovision Ephemeral Environment
name: Test Deprovision Environment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Long name doesn't fit on GH actions list.

Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@caitlynstocker caitlynstocker force-pushed the cat/124036/add-deprovisioning-action branch 3 times, most recently from 317680d to 23b413a Compare October 29, 2025 23:59
},
],
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Matches the create action and runs tests 👍

@caitlynstocker caitlynstocker force-pushed the cat/124036/add-deprovisioning-action branch 2 times, most recently from ed0e491 to 1aeea20 Compare October 30, 2025 00:16
@caitlynstocker caitlynstocker requested a review from a team October 30, 2025 00:17
@@ -1,5 +1,5 @@
node_modules/
dist/
out/
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code gets compiled to 'out/' and then ncc bundles it to 'dist/'. We commit 'dist/' and it is run by the action 👍

Copy link
Copy Markdown
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.

Looks the goods

@caitlynstocker caitlynstocker force-pushed the cat/124036/add-deprovisioning-action branch from 47224b8 to 0f59b70 Compare October 30, 2025 02:59
@caitlynstocker caitlynstocker merged commit 192ec90 into main Oct 30, 2025
3 checks passed
@caitlynstocker caitlynstocker deleted the cat/124036/add-deprovisioning-action branch October 30, 2025 03:02
@caitlynstocker caitlynstocker review requested due to automatic review settings March 23, 2026 23:01
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.

3 participants