Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"ignorePatterns": [
"dist/**/*",
"out/**/*",
"*.js"
]
}
Expand Down
42 changes: 40 additions & 2 deletions .github/workflows/test-deprovision-environment.yml
Original file line number Diff line number Diff line change
@@ -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.


on:
workflow_dispatch:
workflow_dispatch:
inputs:
name:
description: 'The name of the ephemeral environment to deprovision.'
required: true
server:
type: string
description: The url of the Octopus Instance. Will default to repository variable TEST_INSTANCE_URL if not supplied.
service_account_id:
type: string
description: The id of the service account to login for. Will default to repository variable TEST_INSTANCE_SERVICE_ACCOUNT_ID if not supplied.
space:
description: 'The name of the space containing the ephemeral environment. Will default to repository variable TEST_SPACE_NAME if not supplied.'

jobs:
deprovision-environment:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
name: Test Ephemeral Environment Deprovisioning
steps:
- uses: actions/checkout@v3

- name: Login to Octopus Deploy
uses: OctopusDeploy/login@v1
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 🔮✨

- name: Deprovision Ephemeral Environment
id: self_test
uses: ./
with:
name: ${{ inputs.name }}
space: ${{ inputs.space || vars.TEST_SPACE_NAME}}

- name: Show Test Action Output
run: echo "${{ steps.self_test.outputs.deprovisioning_runbook_runs }}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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 👍

coverage/
test-results/
*.log
Expand Down
25 changes: 25 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Deprovision an ephemeral environment in Octopus Deploy'
description: 'GitHub Action to deprovision an ephemeral environment across all projects in Octopus Deploy'
author: 'Octopus Deploy'
branding:
color: 'blue'
icon: 'package'

inputs:
name:
description: 'The name of the ephemeral environment to deprovision.'
required: true
space:
description: 'The name of the space containing the ephemeral environment. The space name is required, but you may also use the OCTOPUS_SPACE environment variable.'
server:
description: 'The instance URL hosting Octopus Deploy (i.e. "https://octopus.example.com/"). The instance URL is required, but you may also use the OCTOPUS_URL environment variable.'
api_key:
description: 'The API key used to access Octopus Deploy. You may also use the OctopusDeploy Login Action, OCTOPUS_API_KEY environment variable or OCTOPUS_ACCESS_TOKEN environment variable. It is strongly recommended that this value be retrieved from a GitHub secret.'

outputs:
deprovisioning_runbook_runs:
description: 'JSON string for an array of objects representing the deprovisioning runbook runs started by this action. Each object contains a `runbookRunId` and `serverTaskId`.'

runs:
using: 'node24'
main: 'dist/index.js'
Loading