From 9f79e3733e0b2b92925a5a7b26f09bc757fb068a Mon Sep 17 00:00:00 2001 From: moilanik Date: Sun, 14 Jun 2026 08:27:32 +0300 Subject: [PATCH] fix: propagate docker exit code using volume-based approach Replace tar|docker|tee pipeline with docker volume + redirect pattern from master. 'docker run > file 2>&1' eliminates the pipe, so 0 directly captures the container exit code. Separate commit status step with if: always() ensures status is reported regardless of test outcome. --- .gitea/workflows/quality-gate.yml | 36 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/quality-gate.yml b/.gitea/workflows/quality-gate.yml index 720b9a6..67100b1 100644 --- a/.gitea/workflows/quality-gate.yml +++ b/.gitea/workflows/quality-gate.yml @@ -49,31 +49,35 @@ jobs: id: bats-tests shell: bash run: | - set +e - set -o pipefail + docker volume create bats-workspace + tar c . | docker run --rm -i -v bats-workspace:/data alpine tar x -C /data mkdir -p "reports/${GITHUB_SHA:0:8}/bats" - tar cf - . | docker run --rm -i \ + set +e + docker run --rm \ + -v bats-workspace:/data \ --entrypoint bash ${{ inputs.bats-image }} \ - -c ' - mkdir -p /repo - tar xf - -C /repo - cd /repo - apk add -q lsof python3 jq curl ruby - bats tests/ - ' 2>&1 | tee "reports/${GITHUB_SHA:0:8}/bats/results.txt" + -c 'apk add -q lsof python3 jq curl ruby && cd /data && bats tests/' \ + > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 BATS_EXIT=$? - bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" || true - - STATE="success" - [ "${BATS_EXIT}" != "0" ] && STATE="failure" - bash .ci/scripts/report-status.sh "${STATE}" "Bats tests" ci-bats - + bash .ci/.gitea/scripts/bats-coverage.sh bats-workspace "reports/${GITHUB_SHA:0:8}/bats" + docker volume rm bats-workspace > /dev/null 2>&1 + bash .ci/.gitea/scripts/bats-report.sh "reports/${GITHUB_SHA:0:8}/bats" + echo "BATS_EXIT=${BATS_EXIT}" >> "${GITHUB_ENV}" exit ${BATS_EXIT} - name: Publish bats reports if: always() run: bash .ci/scripts/publish-git-pages.sh bats + - name: Set bats commit status + if: always() + run: | + if [ "${BATS_EXIT}" = "0" ]; then + bash .ci/scripts/report-status.sh success "Bats tests" ci-bats bats + else + bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats + fi + cucumber: runs-on: ubuntu-latest container: