fix: route push/pull through CLI when cloud storage env vars are set#2820
Merged
maphew merged 1 commit intosteveyegge:mainfrom Mar 26, 2026
Merged
Conversation
f92a7d1 to
56ac1e0
Compare
When bd connects to an external dolt-sql-server (server mode), CALL DOLT_PUSH/PULL executes inside the server process. That process only has the env vars it inherited at startup. If cloud credentials (AZURE_*, AWS_*, GOOGLE_*, etc.) were set or changed after the server started, the SQL path silently fails to authenticate. Add shouldUseCLIForCloudAuth() which detects cloud storage env var prefixes and routes through a CLI subprocess (dolt push/pull) when in server mode. The subprocess inherits the current environment, ensuring credentials always reach the dolt process. Applied to Push, ForcePush, and Pull methods. Closes #6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
56ac1e0 to
6e8a7dc
Compare
Collaborator
|
Thanks @harry-miller-trimble — solid fix for a subtle issue. The CLI fallback when cloud creds are set after server start is a good approach, and the test coverage is thorough. |
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.
Problem
When
bdconnects to an external dolt-sql-server (server mode),CALL DOLT_PUSH/DOLT_PULLexecutes inside the server process. That server only has env vars from when it was started. If cloud credentials (AZURE_STORAGE_ACCOUNT,AWS_ACCESS_KEY_ID, etc.) were set or changed after the server started, the SQL path silently fails to authenticate.This breaks Azure Blob Storage, AWS S3, and GCS remotes when using
bd dolt start(or auto-start) followed bybd dolt push/pull.Fix
Add
shouldUseCLIForCloudAuth()which detects cloud storage env var prefixes and routes through a CLI subprocess (dolt push/dolt pull) when in server mode. The subprocess inherits the current environment, ensuring credentials always reach the dolt process.Cloud env prefixes detected:
AZURE_STORAGE_*— Azure Blob StorageAWS_*— AWS S3GOOGLE_*/GCS_*— Google Cloud StorageOCI_*— Oracle Cloud InfrastructureDOLT_REMOTE_*— Dolt-specific remote credentialsApplied to
Push,ForcePush, andPullmethods in DoltStore.Test Coverage
11 new test cases in
credentials_test.go:Backward Compatibility
Closes harry-miller-trimble#6