fix: propagate docker exit code from bats pipeline with pipefail
Pipeline 'tar | docker | tee' previously always returned tee's exit code (0), masking test failures in the bats job. set -o pipefail makes 0 capture the last failed command's exit code instead.
This commit is contained in:
@@ -50,6 +50,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set +e
|
||||
set -o pipefail
|
||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||
tar cf - . | docker run --rm -i \
|
||||
--entrypoint bash ${{ inputs.bats-image }} \
|
||||
@@ -60,7 +61,7 @@ jobs:
|
||||
apk add -q lsof python3 jq curl ruby
|
||||
bats tests/
|
||||
' 2>&1 | tee "reports/${GITHUB_SHA:0:8}/bats/results.txt"
|
||||
BATS_EXIT=${PIPESTATUS[1]}
|
||||
BATS_EXIT=$?
|
||||
bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" || true
|
||||
|
||||
STATE="success"
|
||||
|
||||
Reference in New Issue
Block a user