Skip to content

Commit a6c79b9

Browse files
committed
chore(ci): allow partial slave restore failures
Add FAIL_ON_SLAVE_ERROR toggle so DB sync can report failed slaves without failing the whole workflow when configured.
1 parent eb9c48e commit a6c79b9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/db-sync.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
env:
1515
DUMP_FILE: /tmp/master_dump.dump
1616
MAX_PARALLEL: 5
17+
FAIL_ON_SLAVE_ERROR: "false"
1718
# ── 从库列表由单个 Secret 管理,每行格式: name|dsn ──
1819
# 新增从库只需编辑 GitHub Secret SLAVE_DSNS,无需改 workflow
1920
SLAVE_DSNS: ${{ secrets.SLAVE_DSNS }}
@@ -251,8 +252,12 @@ jobs:
251252
} >> $GITHUB_ENV
252253
253254
if [ "$FAILED" -gt 0 ]; then
254-
echo "::error::${FAILED}/${TOTAL} slave(s) failed"
255-
exit 1
255+
if [ "${FAIL_ON_SLAVE_ERROR:-true}" = "true" ]; then
256+
echo "::error::${FAILED}/${TOTAL} slave(s) failed"
257+
exit 1
258+
else
259+
echo "::warning::${FAILED}/${TOTAL} slave(s) failed, but allowed"
260+
fi
256261
fi
257262
258263

0 commit comments

Comments
 (0)