fix: keep OCI backup uploads independent of stale offsite targets

This commit is contained in:
juvenal.diaz 2026-10-28 09:05:00 -06:00
parent 99d3b08658
commit c4b3d2132f
1 changed files with 12 additions and 1 deletions

View File

@ -29,6 +29,7 @@ Creates a Pimox-aware, age-encrypted disaster-recovery profile archive.
Optional env:
HOMELAB_PROFILE_BACKUP_DIR Local encrypted archive directory.
HOMELAB_BACKUP_OFFSITE_URI file:///path, /path, or ssh://user@host/path.
HOMELAB_BACKUP_OFFSITE_REQUIRED Set true to fail when the optional offsite push fails.
KUBECONFIG_PATH Kubeconfig for app inventory.
EOF
}
@ -315,7 +316,17 @@ pimox_profile_backup() {
chmod 0600 "${encrypted_archive}"
validate_archive "${encrypted_archive}"
push_offsite "${encrypted_archive}"
# The local encrypted archive is the source consumed by OCI Object
# Storage. A legacy SSH offsite target may be unavailable (for example,
# an old jump-box), so do not prevent the primary backup/upload workflow
# from completing unless the operator explicitly requires that target.
if ! push_offsite "${encrypted_archive}"; then
if [[ "${HOMELAB_BACKUP_OFFSITE_REQUIRED:-false}" == "true" ]]; then
echo "Offsite backup is required and the push failed." >&2
exit 1
fi
log "WARNING: optional offsite push failed; retaining the local encrypted archive."
fi
log "Created encrypted Pimox profile backup: ${encrypted_archive}"
}