Skip to content

sync_to_workspace should read creds from .databrickscfg, not env vars #88

@datasciencemonkey

Description

@datasciencemonkey

The post-commit sync script (sync_to_workspace.py) reads DATABRICKS_HOST and DATABRICKS_TOKEN from environment variables. Since the hook runs as a background process (nohup ... & disown), it may not inherit the app's env vars.

pat_rotator already maintains ~/.databrickscfg with the latest rotated token. The sync script should read from that file instead, which is always on disk and kept current.

Changes:

  • Add _read_databrickscfg() to parse ~/.databrickscfg [DEFAULT] profile
  • get_user_email() reads host/token from config file
  • Strip DATABRICKS_HOST/DATABRICKS_TOKEN from subprocess env so databricks sync CLI also falls through to ~/.databrickscfg

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions