-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add GitHub Action to deprovision an ephemeral environment #4
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
Changes from all commits
6a0a346
eefc3a3
391435c
2229b3e
671890a
d454163
0f59b70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| }, | ||
| "ignorePatterns": [ | ||
| "dist/**/*", | ||
| "out/**/*", | ||
| "*.js" | ||
| ] | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,42 @@ | ||
| name: Test Deprovision Ephemeral Environment | ||
| name: Test Deprovision Environment | ||
|
|
||
| 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 }} | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would need to create a release and deployment using those actions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| node_modules/ | ||
| dist/ | ||
| out/ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
| 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' |
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.
Long name doesn't fit on GH actions list.