Skip to content
Snippets Groups Projects

Updated DrupalSite backup task, as it had misleading message and arbitrary timeout

Open Francisco Borges Aurindo Barros requested to merge improve-backup-task into master
1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
@@ -39,6 +39,10 @@ spec:
export VELERO_NAMESPACE={{ .Values.veleroNamespace }}
export VELERO_BACKUP_STORAGE_LOCATION={{ .Values.veleroBackupStorageLocation }}
envsubst < /tekton-task-templates/backup_resource.yaml | oc create -f -
timeout 120s sh -c -- 'while [[ $(oc get "backup/$RESOURCE_NAME" -n "$VELERO_NAMESPACE" -o jsonpath='{.status.phase}') != "Completed" ]]; do printf "Backup in progress\n"; sleep 2s; done'
backupStatus=$(oc get backup/$RESOURCE_NAME -n $VELERO_NAMESPACE -o=jsonpath='{.status.phase}' | grep -i -E 'failed|completed|partiallyfailed' || echo "Failed")
echo "DrupalSite backup status: $backupStatus"
BACKUP_STATE=$(oc get "backup/$RESOURCE_NAME" -n "$VELERO_NAMESPACE" -o jsonpath='{.status.phase}');
# While the backup is pending OR inProgress, we wait
while [[ ${BACKUP_STATE,,} == "inprogress" || ${BACKUP_STATE,,} == "pending" ]] ; do printf "Backup in state $STATE"; sleep 3s; BACKUP_STATE=$(oc get "backup/$RESOURCE_NAME" -n "$VELERO_NAMESPACE" -o jsonpath='{.status.phase}') ; done
echo "DrupalSite backup status: $BACKUP_STATE"
if [[ ${BACKUP_STATE,,} != "completed" ]]; then
exit 1
fi
Loading