From 47bc81025679f87f72815522bf5c126b523b7712 Mon Sep 17 00:00:00 2001 From: repair-agent Date: Tue, 24 Feb 2026 13:36:26 +0800 Subject: [PATCH] fix(cicd): use set -o pipefail instead of broken PIPESTATUS approach PIPESTATUS[0] was consumed by the echo command before exit could use it, causing build failures to be reported as success. set -o pipefail makes the entire pipe fail if any command fails, which is simpler and correct. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 0e03797..c839152 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -30,13 +30,12 @@ jobs: - name: Build and Push Backend id: build run: | + set -o pipefail docker buildx build \ --push \ --provenance=false \ --tag ${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest \ . 2>&1 | tee /tmp/build.log - echo "build_exit_code=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT - exit ${PIPESTATUS[0]} - name: Setup Kubectl run: | @@ -70,6 +69,7 @@ jobs: sed -i "s|\${CI_REGISTRY_IMAGE}/backend:latest|${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest|g" $DEPLOY_FILE # 3. 应用配置并捕获输出 + set -o pipefail { kubectl apply -f $DEPLOY_FILE kubectl apply -f $INGRESS_FILE