fix(release): require a final SQL backup completion comment
This commit is contained in:
+2
-3
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user