@@ -44,15 +44,21 @@ jobs:
4444 - name : Get Databricks OAuth token
4545 id : oauth
4646 run : |
47- TOKEN_RESPONSE =$(curl -sfS -X POST \
47+ HTTP_CODE =$(curl -s -o /tmp/token_response.json -w "%{http_code}" -X POST \
4848 "https://accounts.cloud.databricks.com/oidc/accounts/968367da-7edd-44f7-9dea-3e0b20b0ec97/v1/token" \
4949 -H "Content-Type: application/x-www-form-urlencoded" \
5050 -d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
5151 -d "subject_token=${SUBJECT_TOKEN}" \
5252 -d "subject_token_type=urn:ietf:params:oauth:token-type:jwt" \
5353 -d "client_id=b76b6808-9e10-43b3-be20-6b6d19ed1af0" \
5454 -d "scope=all-apis")
55- ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r .access_token)
55+ echo "Token exchange HTTP status: $HTTP_CODE"
56+ if [ "$HTTP_CODE" != "200" ]; then
57+ echo "::error::Token exchange failed with HTTP $HTTP_CODE"
58+ cat /tmp/token_response.json
59+ exit 1
60+ fi
61+ ACCESS_TOKEN=$(cat /tmp/token_response.json | jq -r .access_token)
5662 echo "::add-mask::${ACCESS_TOKEN}"
5763 echo "token=${ACCESS_TOKEN}" >> "$GITHUB_OUTPUT"
5864 env :
@@ -171,20 +177,59 @@ jobs:
171177 - name : Get Databricks OAuth token
172178 id : oauth
173179 run : |
174- TOKEN_RESPONSE =$(curl -sfS -X POST \
180+ HTTP_CODE =$(curl -s -o /tmp/token_response.json -w "%{http_code}" -X POST \
175181 "https://accounts.cloud.databricks.com/oidc/accounts/968367da-7edd-44f7-9dea-3e0b20b0ec97/v1/token" \
176182 -H "Content-Type: application/x-www-form-urlencoded" \
177183 -d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
178184 -d "subject_token=${SUBJECT_TOKEN}" \
179185 -d "subject_token_type=urn:ietf:params:oauth:token-type:jwt" \
180186 -d "client_id=b76b6808-9e10-43b3-be20-6b6d19ed1af0" \
181187 -d "scope=all-apis")
182- ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r .access_token)
188+ echo "Token exchange HTTP status: $HTTP_CODE"
189+ if [ "$HTTP_CODE" != "200" ]; then
190+ echo "::error::Token exchange failed with HTTP $HTTP_CODE"
191+ cat /tmp/token_response.json
192+ exit 1
193+ fi
194+ ACCESS_TOKEN=$(cat /tmp/token_response.json | jq -r .access_token)
183195 echo "::add-mask::${ACCESS_TOKEN}"
184196 echo "token=${ACCESS_TOKEN}" >> "$GITHUB_OUTPUT"
185197 env :
186198 SUBJECT_TOKEN : ${{ steps.github-oidc.outputs.token }}
187199
200+ - name : Validate workspace connectivity
201+ run : |
202+ echo "=== Step 1: Simple workspace API call ==="
203+ HTTP_CODE=$(curl -s -o /tmp/ws_response.json -w "%{http_code}" \
204+ "https://dbc-1232e87d-9384.cloud.databricks.com/api/2.0/clusters/spark-versions" \
205+ -H "Authorization: Bearer ${ACCESS_TOKEN}")
206+ echo "Workspace API HTTP status: $HTTP_CODE"
207+ if [ "$HTTP_CODE" != "200" ]; then
208+ echo "::error::Workspace API call failed with HTTP $HTTP_CODE"
209+ cat /tmp/ws_response.json
210+ exit 1
211+ fi
212+ echo "Workspace API: OK"
213+
214+ echo ""
215+ echo "=== Step 2: Model serving endpoint query ==="
216+ HTTP_CODE=$(curl -s -o /tmp/ms_response.json -w "%{http_code}" \
217+ "https://dbc-1232e87d-9384.cloud.databricks.com/serving-endpoints/anthropic/v1/messages" \
218+ -H "Authorization: Bearer ${ACCESS_TOKEN}" \
219+ -H "Content-Type: application/json" \
220+ -d '{"model":"databricks-claude-opus-4-6","max_tokens":20,"messages":[{"role":"user","content":"Say OK"}]}')
221+ echo "Model serving HTTP status: $HTTP_CODE"
222+ if [ "$HTTP_CODE" != "200" ]; then
223+ echo "::error::Model serving endpoint failed with HTTP $HTTP_CODE"
224+ cat /tmp/ms_response.json
225+ exit 1
226+ fi
227+ echo "Model serving response:"
228+ cat /tmp/ms_response.json | jq -r '.content[0].text // "no text"'
229+ echo "Model serving: OK"
230+ env :
231+ ACCESS_TOKEN : ${{ steps.oauth.outputs.token }}
232+
188233 - name : Build settings
189234 id : config
190235 run : |
0 commit comments