Skip to main content
SHELL-SCRIPTING5 MIN READ

Make pipelines report the failure that matters

Handle Bash pipeline failures using `set -o pipefail`, explicit checks, and status inspection where needed.

A database export pipeline can upload an empty artifact if extraction fails but the final command succeeds. Pipeline integrity: enable pipefail, branch on failure, and inspect component status only when diagnosis matters. Do not assume the last command's success proves the whole pipeline succeeded. In Bash's default behavior, the last command controls the pipeline status. Guardrail Start the script with set -euo pipefail if the script is Bash and the team accepts fail-fast defaults. pipefail changes pipeline success from 'last command succeeded' to 'all required stages succeeded'. Branch Wrap the export: if ! psql "$dsn" -c "$query" | gzip |…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us