Skip to content

Add automated oncall rotation sync to Google Group#2

Merged
d-bytebase merged 7 commits intomainfrom
oncall-sync-implementation
Jan 23, 2026
Merged

Add automated oncall rotation sync to Google Group#2
d-bytebase merged 7 commits intomainfrom
oncall-sync-implementation

Conversation

@d-bytebase
Copy link
Contributor

Summary

Implements automated oncall rotation management that syncs the current oncall schedule to a Google Group (dev-oncall@bytebase.com).

  • Schedule parsing: Reads dev.oncall CSV file with rotation periods
  • Google Groups API integration: Uses service account with domain-wide delegation
  • Declarative sync: Group membership always matches current rotation (removes old, adds current)
  • Automated workflow: GitHub Actions runs daily to keep group in sync
  • Comprehensive testing: Full unit test coverage for all components

Key Features

Go CLI Tool (synconcall/)

  • Parses CSV schedule with validation (timestamps, emails, ordering)
  • Determines current rotation based on current time
  • Syncs Google Group membership declaratively
  • Handles edge cases (duplicate members, rotation boundaries, errors)
  • 40+ passing unit tests with mocked Google API

GitHub Actions Workflow

  • Runs daily at midnight UTC (cron: 0 0 * * *)
  • Manual trigger support via workflow_dispatch
  • Uses GOOGLE_SERVICE_ACCOUNT secret for authentication
  • Builds and runs sync tool automatically

Documentation

  • Comprehensive setup guide in root README
  • Service account configuration instructions
  • Tool-specific documentation in synconcall/README.md
  • Design document in docs/plans/

Setup Required

After merging, configure:

  1. Service Account: Create in Google Cloud Console with domain-wide delegation
  2. API Scopes: Grant directory group management scopes in Workspace Admin
  3. GitHub Secret: Add GOOGLE_SERVICE_ACCOUNT with JSON key content

See updated README.md for detailed setup instructions.

Test Plan

  • All unit tests passing (schedule parsing, rotation finding, sync logic)
  • Binary builds successfully
  • CLI flags and help text working
  • Error handling for missing credentials, invalid files, API errors
  • Manual test with real service account (requires setup)
  • GitHub Actions workflow test (after secret is configured)

🤖 Generated with Claude Code

d-bytebase and others added 5 commits January 23, 2026 00:32
Design for a Go CLI tool that syncs current oncall rotation to Google Group
based on a schedule file. Includes schedule parsing, Google API integration,
and declarative sync logic.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add Go CLI tool that syncs current oncall rotation to Google Group:
- Schedule parsing and validation with comprehensive tests
- Google Groups API integration using service account
- Declarative sync logic (group membership matches current rotation)
- CLI with environment variable for credentials
- Full test coverage for all components

The tool reads a CSV schedule file, determines current oncall based on
time, and updates Google Group membership to exactly match the current
primary and secondary oncall people.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add automated daily sync workflow:
- Runs on cron schedule (daily at midnight UTC)
- Supports manual triggering via workflow_dispatch
- Builds and runs synconcall tool with GitHub secrets

Update root README with comprehensive setup guide:
- Schedule file format and usage
- Service account setup instructions
- GitHub secrets configuration
- Manual sync instructions
- Troubleshooting guide

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix authentication by implementing proper domain-wide delegation:
- Add --admin-user flag to specify domain admin for impersonation
- Update GoogleGroupsClient to use JWT config with subject claim
- Service account now impersonates domain admin (d@bytebase.com)
- Update all documentation and examples with new flag

This is required for service accounts to access Google Workspace
Admin SDK APIs. The service account delegates to a domain admin user
to perform group management operations.

Tested successfully with real Google Group sync.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@d-bytebase d-bytebase requested a review from ecmadao January 23, 2026 09:20
d-bytebase and others added 2 commits January 23, 2026 01:23
Add GitHub Actions workflow that runs on PRs:
- Run all Go tests to ensure code quality
- Validate dev.oncall schedule format and structure
- Add 'synconcall validate' subcommand for schedule validation

The validate command checks:
- CSV format correctness
- Timestamp format (RFC3339)
- Email validation
- Chronological ordering
- Current rotation can be determined

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Change schedule from midnight to 1AM UTC to allow rotation to take effect
- Add push trigger for main branch to sync on deployment
- Keep manual workflow_dispatch trigger

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@d-bytebase d-bytebase merged commit a2587a5 into main Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants