Capstone Automation Project
Checklist Gate
Stop on Failure
A release script should stop when a required check fails. This capstone example counts ready checks and records the first blocking step.
Program
Play the script to choose whether the release checklist passes or stops at tests.
release_checklist_gate.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash
failed_step="none"
checks="lint tests build publish"
ready=0
for check in $checks; do
if [[ "$check" == "$failed_step" ]]; then
status="blocked:$check"
break
fi
ready=$((ready + 1))
done
if [[ "$failed_step" == "none" ]]; then
status="ready"
fi
echo "ready=$ready status=$status"
#!/usr/bin/env bash
failed_step="tests"
checks="lint tests build publish"
ready=0
for check in $checks; do
if [[ "$check" == "$failed_step" ]]; then
status="blocked:$check"
break
fi
ready=$((ready + 1))
done
if [[ "$failed_step" == "none" ]]; then
status="ready"
fi
echo "ready=$ready status=$status"
failed_step ← none
3failed_step="none"4checks="lint tests build publish"values this stepnonefailed_stepchecks ← lint tests build publish
3failed_step="none"4checks="lint tests build publish"5ready=0values this steplint tests build publishchecksready ← 0
4checks="lint tests build publish"5ready=06for check in $checks; dovalues this step0readyready ← 1
10 fi11 ready=$((ready + 1))12donevalues this step0 → 1readylintcheckready ← 2
10 fi11 ready=$((ready + 1))12donevalues this step1 → 2readytestscheckready ← 3
10 fi11 ready=$((ready + 1))12donevalues this step2 → 3readybuildcheckready ← 4
10 fi11 ready=$((ready + 1))12donevalues this step3 → 4readypublishcheckif [[ "$failed_step" == "none" ]]; then
12done13if [[ "$failed_step" == "none" ]]; then14 status="ready"values this stepnonefailed_stepstatus ← ready
13if [[ "$failed_step" == "none" ]]; then14 status="ready"15fivalues this stepreadystatusecho "ready=$ready status=$status"
15fi16echo "ready=$ready status=$status"outputready=4 status=readyvalues this step4readyreadystatus
failed_step ← tests
3failed_step="tests"4checks="lint tests build publish"values this steptestsfailed_stepchecks ← lint tests build publish
3failed_step="tests"4checks="lint tests build publish"5ready=0values this steplint tests build publishchecksready ← 0
4checks="lint tests build publish"5ready=06for check in $checks; dovalues this step0readyready ← 1
10 fi11 ready=$((ready + 1))12donevalues this step0 → 1readylintcheckif [[ "$check" == "$failed_step" ]]; then
6for check in $checks; do7 if [[ "$check" == "$failed_step" ]]; then8 status="blocked:$check"values this steptestschecktestsfailed_stepstatus ← blocked:tests
7if [[ "$check" == "$failed_step" ]]; then8 status="blocked:$check"9 breakvalues this stepblocked:testsstatusif [[ "$failed_step" == "none" ]]; then
12done13if [[ "$failed_step" == "none" ]]; then14 status="ready"values this steptestsfailed_stepecho "ready=$ready status=$status"
15fi16echo "ready=$ready status=$status"outputready=1 status=blocked:testsvalues this step1readyblocked:testsstatus
checklist gate
A gate verifies required checks before a release proceeds.
fail fast
Failing fast records the first blocking step instead of hiding it.
release status
A final status line makes the release decision clear.