Skip to content

Latest commit

 

History

History
103 lines (76 loc) · 2.77 KB

File metadata and controls

103 lines (76 loc) · 2.77 KB

Roster

Roster syncs company employee and group data into the database for cost attribution, CI ownership lookup, and issue routing.

The initial design is documented in docs/schema-design.md.

Local Job Entry

The sync command is:

python -m roster.jobs.cli sync-roster

Validate Lark data without writing DB:

python -m roster.jobs.cli validate-lark

Compare synced roster rows with historical employee identity tables:

python -m roster.jobs.cli validate-history --details-limit 20

Print or send the weekly roster change summary:

python -m roster.jobs.cli weekly-summary
python -m roster.jobs.cli weekly-summary --send-lark

Database configuration accepts either a SQLAlchemy URL:

ROSTER_DB_URL='mysql+pymysql://user:pass@host:4000/db?charset=utf8mb4'

or TiDB fields. For compatibility with the existing CI Dashboard DB secret, both ROSTER_TIDB_* and plain TIDB_* names are accepted:

ROSTER_TIDB_HOST=...
ROSTER_TIDB_PORT=4000
ROSTER_TIDB_USER=...
ROSTER_TIDB_PASSWORD=...
ROSTER_TIDB_DB=...

Lark sync is enabled when both of these are present:

ROSTER_LARK_APP_ID=...
ROSTER_LARK_APP_SECRET=...

Optional Lark settings:

ROSTER_LARK_GITHUB_CUSTOM_ATTR_ID=...
ROSTER_LARK_COLLABORATION_TENANT_KEYS=tenant_key_a,tenant_key_b
ROSTER_LARK_NOTIFY_OPEN_ID=...
ROSTER_LARK_NOTIFY_OPEN_IDS=ou_xxx,ou_yyy
ROSTER_LARK_ROOT_DEPARTMENT_ID=0

ROSTER_LARK_COLLABORATION_TENANT_KEYS enables syncing visible linked organization departments and members via the trust party visible organization API. The Lark app must have trust_party:collaboration.tenant:readonly; use trust_party:collaboration_rule:read to list available collaboration tenant keys from the admin API. Linked organization responses do not include Lark custom attributes such as GitHub ID, so this path only fills sparse roster identity and group data.

ROSTER_LARK_NOTIFY_OPEN_ID stays supported for the existing single-recipient setup. Use ROSTER_LARK_NOTIFY_OPEN_IDS when the weekly summary should be sent to multiple users.

Kubernetes CronJob

Build the jobs image from this directory:

docker build -f Dockerfile.jobs -t ghcr.io/pingcap-qe/ee-apps/roster-jobs:<tag> .

Render a CronJob manifest:

./scripts/render_roster_sync_cronjob.sh \
  --image ghcr.io/pingcap-qe/ee-apps/roster-jobs:<tag> \
  --db-secret ci-dashboard-eq-prd-insight-db \
  --lark-secret roster-lark \
  --suspend true \
  > /tmp/roster-sync.yaml

The DB secret should contain ROSTER_DB_URL, CI_DASHBOARD_DB_URL, ROSTER_TIDB_*, or TIDB_* fields. The Lark secret should contain ROSTER_LARK_APP_ID and ROSTER_LARK_APP_SECRET, plus optional ROSTER_LARK_GITHUB_CUSTOM_ATTR_ID and ROSTER_LARK_COLLABORATION_TENANT_KEYS.