From 1c79d1ad0139f63fdf9aeaee573810b76cd3159a Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 27 Apr 2026 11:00:55 +0800 Subject: [PATCH] Fix pipeline pipeline validation by providing auth token to ping endpoints --- .github/workflows/pipeline.yml | 1 + scripts/ci/verify_api_interface_contract.sh | 1 + .../github-actions/report-production-state.sh | 20 ++++++++++++------- scripts/github-actions/validate-deploy.sh | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index c2cfe16..354e4ca 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -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" diff --git a/scripts/ci/verify_api_interface_contract.sh b/scripts/ci/verify_api_interface_contract.sh index c77a610..a6a8e0c 100755 --- a/scripts/ci/verify_api_interface_contract.sh +++ b/scripts/ci/verify_api_interface_contract.sh @@ -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' diff --git a/scripts/github-actions/report-production-state.sh b/scripts/github-actions/report-production-state.sh index c9a4bf4..737c3bd 100644 --- a/scripts/github-actions/report-production-state.sh +++ b/scripts/github-actions/report-production-state.sh @@ -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 diff --git a/scripts/github-actions/validate-deploy.sh b/scripts/github-actions/validate-deploy.sh index 0c54ddf..b2232a0 100755 --- a/scripts/github-actions/validate-deploy.sh +++ b/scripts/github-actions/validate-deploy.sh @@ -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=(