Backups: pipefail on pipeline so pg_dump errors propagate
This commit is contained in:
@@ -91,7 +91,12 @@ spec:
|
|||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -eu
|
# `pipefail` is critical: without it, a failed
|
||||||
|
# pg_dump piped into `aws s3 cp` would still produce
|
||||||
|
# a 0-exit "successful" job (the cp succeeded
|
||||||
|
# uploading empty/garbage data). With pipefail any
|
||||||
|
# element of the pipe failing fails the whole thing.
|
||||||
|
set -euo pipefail
|
||||||
TS=$(date -u +%Y%m%dT%H%M%SZ)
|
TS=$(date -u +%Y%m%dT%H%M%SZ)
|
||||||
KEY="${S3_PREFIX}/${TS}.sql.gz"
|
KEY="${S3_PREFIX}/${TS}.sql.gz"
|
||||||
echo ">>> dumping to s3://${S3_BUCKET}/${KEY}"
|
echo ">>> dumping to s3://${S3_BUCKET}/${KEY}"
|
||||||
|
|||||||
Reference in New Issue
Block a user