Skip to main content

Google Workspace to GitHub Enterprise SCIM synchronization tool

Project description

g2g-scim-sync

A Python CLI tool that synchronizes Google Workspace users and groups to GitHub Enterprise using SCIM provisioning. Designed for scheduled batch execution via cron.

Features

  • One-way sync from Google Workspace to GitHub Enterprise
  • OU-based provisioning - sync users in specified Google Workspace Organizational Units
  • Individual user sync - sync specific users outside of OUs (contractors, consultants, etc.)
  • Automatic idP Group creation - creates missing GitHub idP Groups (teams) from Google OUs
  • OU flattening - converts nested OUs into individual GitHub idP Groups (teams)
  • User lifecycle management - handles create, update, suspend, and delete operations
  • Dry run mode - preview changes without applying them
  • Comprehensive logging - detailed audit trail for all operations
  • Idempotent operations - safe to run multiple times

Requirements

  • Python 3.12+
  • Google Workspace admin access with service account
  • GitHub Enterprise with SCIM API access
  • GitHub enterprise account admin permissions

Installation

# Clone the repository
git clone https://github.com/gmr/g2g-scim-sync
cd g2g-scim-sync

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the package
pip install -e .

Configuration

For detailed setup instructions including Google Workspace and GitHub Enterprise Cloud configuration, see the complete setup guide.

Quick start:

  1. Copy the example configuration:

    cp config.example.toml config.toml
    
  2. Update config.toml with your settings:

    • Google service account JSON file path
    • Google Workspace domain, subject email, and OUs to sync
    • Individual users to sync (optional)
    • GitHub Enterprise hostname, SCIM token, and enterprise account name
    • Sync and logging preferences

Usage

Basic Sync

g2g-scim-sync --config config.toml

Dry Run (Preview Changes)

g2g-scim-sync --config config.toml --dry-run

Force Delete Suspended Users

g2g-scim-sync --config config.toml --delete-suspended

Sync Specific OUs Only

g2g-scim-sync --config config.toml --organizational-units "/Engineering,/Sales"

Sync Individual Users Only

g2g-scim-sync --config config.toml --individual-users "contractor@company.com,consultant@company.com"

Verbose Logging

g2g-scim-sync --config config.toml --verbose

How It Works

  1. Fetch: Retrieves users from specified Google OUs and individual users via Admin SDK
  2. Flatten: Processes nested OU memberships into flat idP Group structure (optional)
  3. Compare: Diffs current GitHub users/idP Groups via SCIM API
  4. Provision: Applies changes (users and idP Groups) via SCIM API
  5. Log: Records all operations for audit trail

User Lifecycle

  • New Users: Provisioned on next sync run
  • Updates: Attribute changes synchronized each run
  • Suspensions: Suspended Google users become inactive in GitHub
  • Deletions: Immediate deprovisioning (requires --delete-suspended)

idP Group Management

  • Google OUs are flattened into individual GitHub idP Groups (configurable)
  • idP Group names use OU names as-is (e.g., "Engineering" → "engineering")
  • Missing GitHub idP Groups are created automatically
  • Nested group memberships cascade (removing from parent removes from children)

Development

# Install development dependencies
pip install -e .[dev]

# Set up pre-commit hooks
pre-commit install

# Run tests
pytest

# Run tests with coverage
pytest --cov=g2g_scim_sync --cov-report=html

# Format code
ruff format

# Lint code
ruff check

License

BSD-3-Clause License. See LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Ensure tests pass and coverage is maintained
  5. Submit a pull request

Support

  • Create an issue on GitHub for bugs or feature requests
  • Check existing issues before creating new ones
  • Provide detailed information including logs and configuration (sanitized)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g2g_scim_sync-1.0.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

g2g_scim_sync-1.0.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file g2g_scim_sync-1.0.0.tar.gz.

File metadata

  • Download URL: g2g_scim_sync-1.0.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for g2g_scim_sync-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bdcb3c7318d5d0a11378630f7353c7616112a855b4f9b9d3240b11f6673d1732
MD5 b75326bb7b6503fba69e261a6ecb050b
BLAKE2b-256 28b4e0ed43c60839303fb161ac1a546f87f02e57f61ea43c58a0a01cb01dd4d0

See more details on using hashes here.

File details

Details for the file g2g_scim_sync-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: g2g_scim_sync-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for g2g_scim_sync-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bfd9d02ffe9df99f1a53163c463872535afd3e0d061a0227016ec3530c59cc0
MD5 2fe5e0139af45cd86f04169986e06a03
BLAKE2b-256 cfbef2489a5c35c06aa3dd11c5c94f06130f003223115d6afbe32be6f93fe8f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page