Fix CI OIDC token caching - #1565
Open
zachajon-cisco wants to merge 1 commit into
Open
Conversation
Signed-off-by: Zachary Jones <zachajon@cisco.com>
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reuses the SDK's refreshable OIDC token source for the built-in GitHub Actions and Azure DevOps authentication providers. This caches an exchanged Databricks access token until it needs to be refreshed instead of requesting and exchanging a new CI OIDC token for every API request.
Why
The
github-oidcandazure-devops-oidcproviders currently create a newClientCredentialstoken source each time credentials are read. Because that token source does not survive the call, its Databricks access-token cache is also discarded after every request.Workloads that make several SDK calls consequently request a new CI OIDC token and perform another Databricks token exchange for every API request. In GitHub Actions, the OIDC request token can become unavailable later in the job, causing otherwise valid authenticated clients to fail with
Cannot get GitHub OIDC token.The SDK already has
DatabricksOidcTokenSource, which caches access tokens and fetches a fresh external ID token when the cached token expires. This change routes both built-in CI providers through that existing implementation.Addresses #1564.
What changed
Interface changes
authorization_detailsargument toDatabricksOidcTokenSourceso the cached path preserves the token-exchange parameters supported by the existing CI provider implementation.Behavioral changes
Internal changes
IdTokenSourceadapter for the existing CI OIDC token-supplier interface.oidc_credentials_providerandDatabricksOidcTokenSource.github-oidcandazure-devops-oidc, including repeated credential reads and preservation of authorization details.How is this tested?
.venv/bin/pytest tests/test_credentials_provider.py tests/test_oidc.py— 123 passed..venv/bin/pytest -q -o log_cli=false -m 'not integration and not benchmark' tests— 2,171 passed, 3 skipped, 135 deselected..venv/bin/ruff check databricks tests— passed..venv/bin/ruff format --check databricks tests— all 157 files formatted.