Skip to content

Commit 4062ce2

Browse files
committed
[static] delete backup on failure
Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
1 parent 548a789 commit 4062ce2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cluster/scripts/node-backup.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ function wait_for_pvc_backup() {
5555
_info "Backup of $description PVC ready!"
5656
break
5757
else
58-
(( i++ )) && (( i > WAIT_FOR_BACKUP_RETRIES )) && _error "Timed out waiting for backup of $description PVC"
58+
(( i++ )) && (( i > WAIT_FOR_BACKUP_RETRIES )) && {
59+
kubectl delete volumesnapshot -n "$namespace" "$backupName";
60+
_error "Timed out waiting for backup of $description PVC";
61+
}
5962
sleep 5
6063
_info "still waiting..."
6164
fi
@@ -149,7 +152,10 @@ function wait_for_cloudsql_backup() {
149152
_info "Backup of $description ready! Backup ID: $id "
150153
break
151154
else
152-
(( i++ ))&& (( i > WAIT_FOR_BACKUP_RETRIES )) &&_error "Timed out waiting for backup of $description db"
155+
(( i++ ))&& (( i > WAIT_FOR_BACKUP_RETRIES )) && {
156+
gcloud sql backups delete "$id" --instance "$db_id" --quiet;
157+
_error "Timed out waiting for backup of $description db";
158+
}
153159
sleep 5
154160
_info "still waiting..."
155161
fi

0 commit comments

Comments
 (0)