Some checks failed
CI / skinny-install (aco) (push) Successful in 1m12s
CI / skinny-install (api) (push) Successful in 30s
CI / skinny-install (bcda) (push) Successful in 36s
CI / skinny-install (bib) (push) Successful in 35s
CI / skinny-install (bls) (push) Successful in 27s
CI / skinny-install (ccw) (push) Successful in 32s
CI / skinny-install (cli) (push) Successful in 41s
CI / skinny-install (cms) (push) Successful in 37s
CI / skinny-install (conf) (push) Successful in 38s
CI / skinny-install (opps) (push) Successful in 33s
CI / skinny-install (perf) (push) Successful in 38s
CI / skinny-install (pfs) (push) Successful in 38s
CI / skinny-install (rex) (push) Successful in 34s
Deploy / build-scan-report (push) Failing after 46s
Infra CI / notebooks (push) Failing after 25s
Infra CI / zotero (push) Successful in 12s
Infra CI / docs (push) Failing after 16s
CI / lint-test (push) Failing after 11m2s
Infra CI / mc (push) Successful in 21s
Infra CI / api (push) Successful in 29s
Package Supply Chain / pkg-supply-chain (push) Failing after 41s
Mail: Maddy on DO (corwins.media+Resend, fhirworx.io+Postmark), touchless/stateless/idempotent. Gitea SMTP via env_file. CMS inbox at cmsupdates@mail.fhirworx.io with IMAP→bib poller. Bib: regulations.gov v4 client, Federal Register discovery, 164K comment backfill (running), IMAP email ingest, Zotero sync routing. PRISMA: altcha PoW solver, CrossRef DOI resolution, 83/129 PDFs. Zotero: schema parity, ops module, CLI, fail-fast guard. CI: docs.Dockerfile COPY glob fix (tracks #341). Infra: Gitea+marimo fhirworx themes, IOM/OIG modules.
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
"""Sync environment variables to Databricks secret scopes.
|
|
|
|
Reads the ``[databricks.secrets]`` section from ``stack.toml``
|
|
and pushes matching environment variables into a Databricks scope
|
|
via the SDK.
|
|
|
|
Usage::
|
|
|
|
uv run python dev/scripts/sync_secrets.py # sync
|
|
uv run python dev/scripts/sync_secrets.py --dry-run # preview
|
|
uv run python dev/scripts/sync_secrets.py --list # show current secrets
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
from conf import cfg
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument(
|
|
"--dry-run", action="store_true", help="preview without changes"
|
|
)
|
|
parser.add_argument(
|
|
"--list", action="store_true", help="list current secrets in scope"
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
secrets_cfg = getattr(cfg.databricks, "secrets", None)
|
|
if not secrets_cfg:
|
|
print("No [databricks.secrets] section in stack.toml")
|
|
return 1
|
|
|
|
scope = secrets_cfg.scope
|
|
mapping_list = secrets_cfg.mapping or []
|
|
|
|
# Build env→key mapping
|
|
mapping = {item["env"]: item["key"] for item in mapping_list}
|
|
|
|
if not mapping:
|
|
print("No secret mappings defined in [databricks.secrets]")
|
|
return 0
|
|
|
|
from aco.lake.unity import UnityClient
|
|
|
|
client = UnityClient.from_env()
|
|
|
|
if args.list:
|
|
try:
|
|
keys = client.list_secrets(scope)
|
|
print(f"Secrets in scope '{scope}':")
|
|
for k in keys:
|
|
print(f" {k}")
|
|
if not keys:
|
|
print(" (empty)")
|
|
except Exception as e:
|
|
print(f"Error listing secrets: {e}")
|
|
return 0
|
|
|
|
actions = client.sync_secrets(scope, mapping, dry_run=args.dry_run)
|
|
for action in actions:
|
|
print(action)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|