From 2213ee911cc64aff3502e1ddac5b1b00c0a977a9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 1 Oct 2024 01:09:37 -0400 Subject: [PATCH] fix: Update to MorphoCloud/MorphoCloudWorkflow@39f04ff List of MorphoCloudWorkflow changes: ``` $ git shortlog 831e698..39f04ff --no-merges Jean-Christophe Fillion-Robin (1): feat: Add support for /delete_all command ``` See https://github.com/MorphoCloud/MorphoCloudWorkflow/compare/831e698...39f04ff --- .../workflows/delete-instance-and-volume.yml | 52 +++++++++++++++++++ issue-commands.md | 1 + 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/delete-instance-and-volume.yml diff --git a/.github/workflows/delete-instance-and-volume.yml b/.github/workflows/delete-instance-and-volume.yml new file mode 100644 index 00000000..15978628 --- /dev/null +++ b/.github/workflows/delete-instance-and-volume.yml @@ -0,0 +1,52 @@ +name: Delete Instance and Volume + +on: + issue_comment: + types: [created] + +jobs: + delete_instance_and_volume: + runs-on: self-hosted + if: + ${{ !github.event.issue.pull_request && ( + contains(github.event.comment.body, '/delete_all') ) }} + steps: + - name: delete_instance_and_volume command + id: delete_instance_and_volume_command + uses: github/command@v1.2.0 + with: + command: "/delete_all" + reaction: "rocket" + allowed_contexts: "issue" + permissions: "write,maintain,admin" + allowlist: "${{ vars.MORPHOCLOUD_GITHUB_ADMINS }}" + + - uses: actions/checkout@v4 + + - name: Delete volume + id: delete_volume + if: + ${{ steps.delete_instance_and_volume_command.outputs.continue == + 'true' }} + uses: ./.github/actions/delete-volume + with: + os_cloud: ${{ vars.MORPHOCLOUD_OS_CLOUD }} + issue_number: ${{ github.event.issue.number }} + instance_name_prefix: ${{ vars.INSTANCE_NAME_PREFIX }} + volume_name_suffix: ${{ vars.VOLUME_NAME_SUFFIX }} + + - name: Delete instance + id: delete_instance + if: + ${{ steps.delete_instance_and_volume_command.outputs.continue == + 'true' }} + uses: ./.github/actions/control-instance + with: + os_cloud: ${{ vars.MORPHOCLOUD_OS_CLOUD }} + issue_number: ${{ github.event.issue.number }} + command_name: "delete" + instance_name_prefix: ${{ vars.INSTANCE_NAME_PREFIX }} + token: ${{ secrets.GITHUB_TOKEN }} + string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }} + mail_server_username: ${{secrets.MAIL_USERNAME}} + mail_server_password: ${{secrets.MAIL_PASSWORD}} diff --git a/issue-commands.md b/issue-commands.md index 32fdd07f..bf156be2 100644 --- a/issue-commands.md +++ b/issue-commands.md @@ -13,3 +13,4 @@ may be entered per comment._ | `/create` | Create the instance and associated volume. | Admin | | `/delete_instance` | Delete the instance. | Admin | | `/delete_volume` | Delete the volume. | Admin | +| `/delete_all` | Delete the instance and volume. | Admin |