feat: include Gitea and OpenTofu state in OCI backups
This commit is contained in:
parent
5980e4c6a0
commit
99d3b08658
|
|
@ -77,7 +77,10 @@ case "${ACTION}" in
|
|||
exec "${REPO_ROOT}/scripts/oci-backup-status" "${ACTION}"
|
||||
;;
|
||||
upload)
|
||||
"${REPO_ROOT}/scripts/homelab-backup" pimox-profile
|
||||
# Run the complete local backup workflow first so the OCI archive
|
||||
# includes fresh Gitea and OpenTofu state artifacts, not just the
|
||||
# Pimox inventory.
|
||||
"${REPO_ROOT}/jeannie" backup
|
||||
archive="$(latest_archive)"
|
||||
[[ -n "${archive}" ]] || { echo "No encrypted archive was created." >&2; exit 1; }
|
||||
upload_archive "${archive}"
|
||||
|
|
@ -97,7 +100,15 @@ case "${ACTION}" in
|
|||
--region "${OCI_REGION}" --namespace-name "${NAMESPACE}" --bucket-name "${BUCKET}" \
|
||||
--name "${object}.sha256" --file "${tmpdir}/archive.sha256" >/dev/null
|
||||
(cd "${tmpdir}" && sha256sum -c archive.sha256)
|
||||
age -d -i "${AGE_KEY_FILE}" "${tmpdir}/archive.tgz.age" | tar -tzf - >/dev/null
|
||||
listing="$(age -d -i "${AGE_KEY_FILE}" "${tmpdir}/archive.tgz.age" | tar -tzf -)"
|
||||
grep -q 'gitea/latest-gitea-backup.zip' <<<"${listing}" || {
|
||||
echo 'restore verification failed: Gitea backup is missing from archive.' >&2
|
||||
exit 1
|
||||
}
|
||||
grep -q '^tofu-state/' <<<"${listing}" || {
|
||||
echo 'restore verification failed: OpenTofu state is missing from archive.' >&2
|
||||
exit 1
|
||||
}
|
||||
printf 'restore_verification=ok\nobject=%s\n' "${object}"
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue