fix(release): require a final SQL backup completion comment

This commit is contained in:
cesnimda
2026-11-18 01:11:02 +01:00
parent 2fb41a96ce
commit 2fb10f7b4e
5 changed files with 148 additions and 3 deletions
+2 -3
View File
@@ -426,10 +426,9 @@ verify_sql_backup() {
local has_schema=1 has_trailer=1
set +o pipefail
if gzip -dc "$target" | grep -q "CREATE TABLE"; then has_schema=0; fi
# mariadb-dump / mysqldump write "-- Dump completed on ..." as the last line.
# Its absence means the dump died partway through.
if gzip -dc "$target" | grep -q "Dump completed"; then has_trailer=0; fi
set -o pipefail
# Require the final nonblank completion comment, not that phrase in SQL data.
if gzip -dc "$target" | awk '{ sub(/\r$/, "") } NF { last=$0 } END { exit !(last ~ /^-- Dump completed( on .*)?$/) }'; then has_trailer=0; fi
if [ "$has_schema" -ne 0 ]; then
echo "Backup ${target} contains no CREATE TABLE statement — it is not a usable dump. Aborting deploy."