Skip to content
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

Fix: CI Droplet cleanup failed when same name was used #633

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

hoh
Copy link
Member

@hoh hoh commented Jun 14, 2024

When there were multiple Droplets with the same name, cleanup using doctl compute droplet delete -f $NAME would not work.

Error: There are 3 Droplets with the name "aleph-vm-ci-XXX"; please provide a specific Droplet ID. [425559566, 425702949, 425703724]

When there were multiple Droplets with the same name, cleanup using doctl compute droplet delete -f $NAME would not work.

Error: There are 3 Droplets with the name "aleph-vm-ci-XXX"; please provide a specific Droplet ID. [425559566, 425702949, 425703724]
Copy link

The PR does not appear to contain any substantial changes to the codebase. It's a small refactoring to clean up the GitHub Actions workflow file, which may not introduce any bugs but does require a thorough review for potential issues.

diff  --git a/.github/workflows/test-on-droplets-matrix.yml b/.github/workflows/test-on-droplets-matrix.yml
index 1493af67..c6d048d4 100644
--- a/.github/workflows/test-on-droplets-matrix.yml
+++ b/.github/workflows/test-on-droplets-matrix.yml
@@ -176,4 +176,9 @@ jobs:
        - name: Cleanup
         if: always()
         run: |
-          doctl compute droplet delete  -f aleph-vm-ci-${{ matrix.os_config.alias  }} -${{ matrix.check_vm.alias  }}
+          DROPLET_IDS=$(doctl compute droplet list  --format "ID,Name"  --no-header | grep "aleph-vm-ci-${{ matrix.os_config.alias  }} -${{ matrix.check_vm.alias  }}" | awk  '{print $1}')
+
+          for DROPLET_ID in $DROPLET_IDS; do
+            echo "Deleting droplet with ID: $DROPLET_ID"
+            doctl compute droplet delete  --force $DROPLET_ID
+          done

This PR may be reviewed by any developer, but it's recommended to have a deep understanding of the project architecture.

@github-actions github-actions bot added the BLUE This PR is simple and straightforward. label Jun 14, 2024
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.73%. Comparing base (1095e3f) to head (7a82f49).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #633   +/-   ##
=======================================
  Coverage   58.73%   58.73%           
=======================================
  Files          62       62           
  Lines        5481     5481           
  Branches      608      608           
=======================================
  Hits         3219     3219           
  Misses       2122     2122           
  Partials      140      140           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hoh hoh merged commit b824503 into main Jun 14, 2024
25 checks passed
@Psycojoker Psycojoker deleted the hoh-fix-multiple-droplet-cleanup branch July 24, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLUE This PR is simple and straightforward.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants