fix: strip whitespace from Coolify token in deploy step
Root cause: COOLIFY_TOKEN secret had a leading space (0x20) causing 401 Unauthenticated. Strip whitespace with tr before passing to curl. Also removes debug diagnostics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,24 +58,14 @@ jobs:
|
||||
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
|
||||
COOLIFY_WEBHOOK: ${{ vars.COOLIFY_WEBHOOK }}
|
||||
run: |
|
||||
echo "Token length: ${#COOLIFY_TOKEN}"
|
||||
echo "Token first 3 chars: $(printf '%.3s' "${COOLIFY_TOKEN}")"
|
||||
printf '%s' "${COOLIFY_TOKEN}" | hexdump -C | head -4
|
||||
echo "Webhook URL: ${COOLIFY_WEBHOOK}"
|
||||
echo "--- Attempt 1: manual Bearer header ---"
|
||||
TOKEN=$(printf '%s' "${COOLIFY_TOKEN}" | tr -d '[:space:]')
|
||||
RESPONSE=$(curl -s -w '\n%{http_code}' -X GET "${COOLIFY_WEBHOOK}" \
|
||||
-H "Authorization: Bearer ${COOLIFY_TOKEN}")
|
||||
-H "Authorization: Bearer ${TOKEN}")
|
||||
STATUS=$(echo "$RESPONSE" | tail -1)
|
||||
BODY=$(echo "$RESPONSE" | sed '$d')
|
||||
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"
|
||||
echo "Coolify deploy: HTTP ${STATUS}"
|
||||
if [ "$STATUS" -ge 400 ]; then
|
||||
echo "::error::Coolify deploy failed with HTTP ${STATUS} - ${BODY}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user