diff --git a/content/docs/manage/backups-aws-s3-backup-part-2.md b/content/docs/manage/backups-aws-s3-backup-part-2.md index d0ed7c9f3e..8f46da02bc 100644 --- a/content/docs/manage/backups-aws-s3-backup-part-2.md +++ b/content/docs/manage/backups-aws-s3-backup-part-2.md @@ -121,7 +121,9 @@ jobs: - name: Run pg_dump run: | - $POSTGRES/pg_dump ${{ env.DATABASE_URL }} | gzip > "${{ env.GZIP_NAME }}" + set -o pipefail + : "${DATABASE_URL:?DATABASE_URL secret is not set}" + "${POSTGRES}/pg_dump" "$DATABASE_URL" | gzip > "$GZIP_NAME" - name: Empty bucket of old files run: | @@ -255,9 +257,13 @@ This step runs `pg_dump` and saves the output in the Action's virtual memory usi ```yml - name: Run pg_dump run: | - $POSTGRES/$pg_dump ${{ env.DATABASE_URL }} | gzip > "${{ env.GZIP_NAME }}" + set -o pipefail + : "${DATABASE_URL:?DATABASE_URL secret is not set}" + "${POSTGRES}/pg_dump" "$DATABASE_URL" | gzip > "$GZIP_NAME" ``` +Enabling `pipefail` ensures the workflow fails when `pg_dump` fails instead of reporting success because `gzip` completed. + ## Empty bucket of old files This optional step automatically removes `.gz` files older than the retention period specified by the `RETENTION` variable. It checks the `FOLDER_NAME` directory and deletes outdated backups to save storage space.