Skip to content

Make GCP SA token refresh non-blocking with warning on failure#718

Draft
hectorcast-db wants to merge 1 commit intohectorcast-db/stack/port-5-token-audience-from-metadatafrom
hectorcast-db/stack/port-6-gcp-sa-nonblocking
Draft

Make GCP SA token refresh non-blocking with warning on failure#718
hectorcast-db wants to merge 1 commit intohectorcast-db/stack/port-5-token-audience-from-metadatafrom
hectorcast-db/stack/port-6-gcp-sa-nonblocking

Conversation

@hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Mar 19, 2026

🥞 Stacked PR


Summary

Port of Go SDK #1544.

Makes the GCP SA access token (X-Databricks-GCP-SA-Access-Token) refresh non-blocking in both GoogleIdCredentialsProvider and GoogleCredentialsCredentialsProvider. On failure, a warning is logged and the header is skipped instead of throwing an exception. The token is now always attempted regardless of client type (previously only for ACCOUNT clients).

Why: On unified hosts, the config type may not perfectly distinguish account vs workspace operations. Making the SA token optional ensures GCP auth doesn't fail when the SA token isn't needed.

Changes:

  • GoogleIdCredentialsProvider: removed ClientType.ACCOUNT guard, catch IOException and log warning
  • GoogleCredentialsCredentialsProvider: same pattern

NO_CHANGELOG=true

Test plan

  • Verify GCP auth works for account and workspace clients
  • Verify warning is logged when SA token refresh fails

github-merge-queue bot pushed a commit that referenced this pull request Mar 19, 2026
## 🥞 Stacked PR

- [**#710 Add cloud field to
HostMetadata**](#710)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/710/files)]
- [#711 Fix GetWorkspaceClient for unified account
hosts](#711)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/711/files)]
- [#712 Add test for GetWorkspaceClient with SPOG
host](#712)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/712/files)]
- [#713 Call resolveHostMetadata on Config
init](#713)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/713/files)]
- [#714 Resolve TokenAudience from host metadata for account
hosts](#714)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/714/files)]
- [#718 Make GCP SA token refresh
non-blocking](#718)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/718/files)]
- [#719 Add integration test for host metadata
resolution](#719)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/719/files)]
- [#720 Remove unified flag usage, rely on host
metadata](#720)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/720/files)]

---------
## Summary

Port of Go SDK
[#1512](databricks/databricks-sdk-go#1512).

Adds a `cloud` field to `HostMetadata` that is populated from the
`/.well-known/databricks-config` discovery endpoint.

**Why:** Today, `isAws()`, `isAzure()`, and `isGcp()` infer cloud type
by suffix-matching the workspace hostname against a hardcoded list of
known DNS zones. This works for standard deployments but fails for
non-standard hostnames (custom vanity domains, unified hosts, etc.). The
discovery endpoint is the authoritative source and already returns a
`cloud` field, but the SDK was discarding it.

**Changes:**
- `HostMetadata`: new `cloud` field (`@JsonProperty("cloud")`), getter,
and 4-arg constructor
- `HostMetadataTest`: deserialization with/without cloud, constructor
tests

`NO_CHANGELOG=true`

## Test plan
- [x] `HostMetadataTest`: 4 tests for cloud field deserialization and
constructors
Port of Go SDK #1544. The GCP SA access token
(X-Databricks-GCP-SA-Access-Token) refresh is now non-blocking in both
GoogleIdCredentialsProvider and GoogleCredentialsCredentialsProvider.
On failure, a warning is logged and the header is skipped instead of
throwing an exception. The token is also now always attempted regardless
of client type (not just for ACCOUNT clients).

Co-authored-by: Isaac
@hectorcast-db hectorcast-db force-pushed the hectorcast-db/stack/port-5-token-audience-from-metadata branch from f8a984d to f1240ce Compare March 19, 2026 11:53
@hectorcast-db hectorcast-db force-pushed the hectorcast-db/stack/port-6-gcp-sa-nonblocking branch from 7a65c41 to 2bddb2c Compare March 19, 2026 11:53
github-merge-queue bot pushed a commit that referenced this pull request Mar 19, 2026
## 🥞 Stacked PR

- [#710 Add cloud field to
HostMetadata](#710)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/710/files)]
- [**#711 Fix GetWorkspaceClient for unified account
hosts**](#711)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/711/files)]
- [#712 Add test for GetWorkspaceClient with SPOG
host](#712)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/712/files)]
- [#713 Call resolveHostMetadata on Config
init](#713)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/713/files)]
- [#714 Resolve TokenAudience from host metadata for account
hosts](#714)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/714/files)]
- [#718 Make GCP SA token refresh
non-blocking](#718)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/718/files)]
- [#719 Add integration test for host metadata
resolution](#719)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/719/files)]
- [#720 Remove unified flag usage, rely on host
metadata](#720)
[[Files](https://github.com/databricks/databricks-sdk-java/pull/720/files)]

---------
## Summary

Port of Go SDK
[#1517](databricks/databricks-sdk-go#1517).

Fixes `getWorkspaceClient()` for unified account hosts that don't follow
the standard environment DNS zone pattern (e.g. SPOG/unified hosts).
Previously, the workspace host was always constructed via
`getDeploymentUrl(ws.getDeploymentName())`, which blindly appends the
environment's DNS zone. For unified hosts where the account and
workspace share the same host, this produces an incorrect URL.

**Changes:**
- `AccountClient.getWorkspaceClient()`: clones config instead of
mutating `this.config` for unified hosts

**Note:** `AccountClient.java` is a generated file. The template needs
to be updated.

`NO_CHANGELOG=true`

## Test plan
- [x] `AccountClientTest`: existing tests pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant