From 8cdeeb26007bb4c33fcd1b8a94d92b508fad23d6 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sat, 11 Apr 2026 00:25:55 +0200 Subject: [PATCH] debug: deeper Coolify token diagnostics Add hex dump of token prefix to check for hidden characters, and try curl --oauth2-bearer as alternative auth method. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index dfabca3..0e134bb 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -59,16 +59,24 @@ jobs: COOLIFY_WEBHOOK: ${{ vars.COOLIFY_WEBHOOK }} run: | echo "Token length: ${#COOLIFY_TOKEN}" - echo "Token contains pipe: $(echo "${COOLIFY_TOKEN}" | grep -c '|')" + echo "Token first 3 chars: $(printf '%.3s' "${COOLIFY_TOKEN}")" + echo "Token hex (first 20 bytes):" + printf '%s' "${COOLIFY_TOKEN}" | od -A x -t x1z -N 20 echo "Webhook URL: ${COOLIFY_WEBHOOK}" + echo "--- Attempt 1: manual Bearer header ---" RESPONSE=$(curl -s -w '\n%{http_code}' -X GET "${COOLIFY_WEBHOOK}" \ -H "Authorization: Bearer ${COOLIFY_TOKEN}") STATUS=$(echo "$RESPONSE" | tail -1) BODY=$(echo "$RESPONSE" | sed '$d') - echo "Coolify deploy response: HTTP ${STATUS}" - echo "Response body: ${BODY}" - if [ "$STATUS" -ge 400 ]; then - echo "::error::Coolify deploy failed with HTTP ${STATUS} - ${BODY}" + echo "HTTP ${STATUS} - ${BODY}" + echo "--- Attempt 2: curl --oauth2-bearer ---" + RESPONSE2=$(curl -s -w '\n%{http_code}' -X GET "${COOLIFY_WEBHOOK}" \ + --oauth2-bearer "${COOLIFY_TOKEN}") + STATUS2=$(echo "$RESPONSE2" | tail -1) + BODY2=$(echo "$RESPONSE2" | sed '$d') + echo "HTTP ${STATUS2} - ${BODY2}" + if [ "$STATUS" -ge 400 ] && [ "$STATUS2" -ge 400 ]; then + echo "::error::Coolify deploy failed - both attempts returned errors" exit 1 fi