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
The post-commit sync script (
sync_to_workspace.py) readsDATABRICKS_HOSTandDATABRICKS_TOKENfrom environment variables. Since the hook runs as a background process (nohup ... & disown), it may not inherit the app's env vars.pat_rotatoralready maintains~/.databrickscfgwith the latest rotated token. The sync script should read from that file instead, which is always on disk and kept current.Changes:
_read_databrickscfg()to parse~/.databrickscfg[DEFAULT]profileget_user_email()reads host/token from config fileDATABRICKS_HOST/DATABRICKS_TOKENfrom subprocess env sodatabricks syncCLI also falls through to~/.databrickscfg