Fix pipeline pipeline validation by providing auth token to ping endpoints

This commit is contained in:
Haitao Pan 2026-04-27 11:00:55 +08:00
parent caf541995e
commit 1c79d1ad01
4 changed files with 16 additions and 7 deletions

View File

@ -55,6 +55,7 @@ jobs:
id: production_state
env:
BRIDGE_SERVER_URL: https://xworkmate-bridge.svc.plus
BRIDGE_AUTH_TOKEN: ${{ secrets.INTERNAL_SERVICE_TOKEN }}
run: |
while IFS='=' read -r key value; do
echo "${key}=${value}" >> "$GITHUB_OUTPUT"

View File

@ -34,6 +34,7 @@ ping_json="$(
--fail \
--location \
--max-time 20 \
-H "Authorization: Bearer ${BRIDGE_AUTH_TOKEN}" \
"${BRIDGE_SERVER_URL%/}/api/ping"
)"
PING_JSON="${ping_json}" python3 - <<'PY'

View File

@ -23,15 +23,21 @@ ping_json=""
attempts=6
sleep_seconds=5
curl_args=(
--silent
--show-error
--fail
--location
--max-time 20
)
if [[ -n "${BRIDGE_AUTH_TOKEN:-}" ]]; then
curl_args+=(-H "Authorization: Bearer ${BRIDGE_AUTH_TOKEN}")
fi
for ((attempt = 1; attempt <= attempts; attempt += 1)); do
if ping_json="$(
curl \
--silent \
--show-error \
--fail \
--location \
--max-time 20 \
"${ping_url}"
curl "${curl_args[@]}" "${ping_url}"
)"; then
if [[ -n "${ping_json}" ]]; then
break

View File

@ -39,6 +39,7 @@ fast_http_curl_common=(
--fail
--location
--max-time "${FAST_HTTP_TIMEOUT_SECONDS}"
-H "Authorization: Bearer ${AUTH_TOKEN}"
)
bridge_rpc_curl_common=(