mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 09:32:32 +08:00
Updated DeleteDroplet workflow to use new token
This commit is contained in:
parent
5ad21606f2
commit
021cebdd09
1 changed files with 22 additions and 6 deletions
28
.github/workflows/deletedroplets.yml
vendored
28
.github/workflows/deletedroplets.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
|||
- name: delete droplets
|
||||
if: success() || failure()
|
||||
run: |
|
||||
sleep 5m
|
||||
sleep 1m
|
||||
response=$(curl -X DELETE \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||
|
@ -56,8 +56,9 @@ jobs:
|
|||
echo "Failed to delete droplets. Status code: $status_code"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1m
|
||||
env:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||
- name: mark server as available
|
||||
if: success() || failure()
|
||||
|
@ -108,13 +109,28 @@ jobs:
|
|||
- name: delete droplets
|
||||
if: success() || failure()
|
||||
run: |
|
||||
sleep 3h
|
||||
curl -X DELETE \
|
||||
sleep 1m
|
||||
response=$(curl -X DELETE \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG"
|
||||
-w "\n%{http_code}" \
|
||||
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG")
|
||||
|
||||
status_code=$(echo "$response" | tail -n1)
|
||||
body=$(echo "$response" | sed '$d')
|
||||
|
||||
echo "Response body: $body"
|
||||
echo "Status code: $status_code"
|
||||
|
||||
if [ "$status_code" -eq 204 ]; then
|
||||
echo "Droplets deleted successfully"
|
||||
else
|
||||
echo "Failed to delete droplets. Status code: $status_code"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1m
|
||||
env:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DO_TEST_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
|
||||
- name: mark server as available
|
||||
if: success() || failure()
|
||||
|
|
Loading…
Reference in a new issue