fix(cicd): use set -o pipefail instead of broken PIPESTATUS approach
Some checks failed
Build and Deploy Backend / build-and-deploy (push) Failing after 57s
Some checks failed
Build and Deploy Backend / build-and-deploy (push) Failing after 57s
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 <noreply@anthropic.com>
This commit is contained in:
parent
ebe555216b
commit
47bc810256
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user