Skip to content

Add gl2gh GitLab adapter#1555

Merged
brianaj merged 87 commits into
mainfrom
add-gitlab-archive-adapter
May 28, 2026
Merged

Add gl2gh GitLab adapter#1555
brianaj merged 87 commits into
mainfrom
add-gitlab-archive-adapter

Conversation

@synthead
Copy link
Copy Markdown
Contributor

@synthead synthead commented May 18, 2026

Closes https://github.ghe.com/github/octoshift/issues/12185!

Introduces gl2gh, a new CLI extension for migrating from GitLab (gitlab.com or self-managed) to GitHub using the GEI APIs. Mirrors the structure and conventions of the existing ado2gh / bbs2gh CLIs.

What's included

  • gl2gh CLI with commands: inventory-report, generate-script, migrate-repo, plus the standard shared commands (wait-for-migration, grant-/revoke-migrator-role, reclaim-mannequin, create-team, download-logs, abort-migration, generate-mannequin-csv).
  • GitlabApi + GitlabClient with paginated group/project discovery, archive export polling, and a 429-aware retry policy honoring Retry-After.
  • Archive flow: export from GitLab → download → upload to Azure / AWS S3 / GitHub-owned storage → import via GEI.
  • Inventory CSVs: groups.csv and projects.csv for migration planning.
  • CI: integration test job (Integration Test Results - Gitlab) running on Linux/Windows/macOS against three e2e orgs, and a release-publishing step targeting github/gh-gl2gh.
  • Docs: README + RELEASENOTES updated. gl2gh is flagged as not yet generally available.

Other stuff

This PR only ships the adapter. The github/gh-gl2gh extension repo and the SAML/feature-flag setup for the e2e orgs are tracked in the linked issue.

  • Tests added (unit + integration) and functional
  • Release notes updated
  • Appropriate logging output
  • Issue linked
  • Docs updated
  • Did you write/update appropriate tests
  • Release notes updated (if appropriate)
  • Appropriate logging output
  • Issue linked
  • Docs updated (or issue created)
  • New package licenses are added to ThirdPartyNotices.txt (if applicable)

synthead added 30 commits April 7, 2026 14:50
Comment thread src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs Fixed
Comment thread src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs Fixed
Comment thread src/gl2gh/Commands/MigrateRepo/MigrateRepoCommandHandler.cs Dismissed
Comment thread src/gl2gh/Commands/MigrateRepo/MigrateRepoCommandHandler.cs Fixed
Comment thread src/gl2gh/Program.cs Dismissed
Comment thread src/gl2gh/Program.cs Dismissed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new gl2gh GitHub CLI extension for GitLab-to-GitHub migrations, adding a GitLab API/client implementation in shared Octoshift services and wiring the new extension into build, publish, docs, and CI/integration test flows.

Changes:

  • Added gl2gh extension project with commands for generating scripts, inventory reporting, and migrating repos (plus standard supporting commands).
  • Implemented GitLab API + HTTP client (GitlabApi, GitlabClient) and added GitHub API support for GitLab migration sources/migrations.
  • Updated CI/e2e workflows, publishing scripts, and documentation/release notes to include gl2gh.
Show a summary per file
File Description
src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj References gl2gh project for unit test compilation.
src/OctoshiftCLI.Tests/Octoshift/Services/GitlabApiTests.cs Adds unit coverage for GitLab version parsing/logging.
src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs Adds coverage for GitLab migration GraphQL payload behavior.
src/OctoshiftCLI.Tests/gl2gh/Services/ProjectsCsvGeneratorServiceTests.cs Tests projects.csv generation behavior for GitLab inventory report.
src/OctoshiftCLI.Tests/gl2gh/Services/GitlabInspectorServiceTests.cs Tests GitLab inspection/caching behaviors.
src/OctoshiftCLI.Tests/gl2gh/Factories/GitlabApiFactoryTests.cs Verifies factory creates API with correct HTTP client configuration.
src/OctoshiftCLI.Tests/gl2gh/Commands/WaitForMigration/WaitForMigrationCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/ReclaimMannequin/ReclaimMannequinCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/MigrateRepo/MigrateRepoCommandTests.cs Verifies option surface for migrate-repo.
src/OctoshiftCLI.Tests/gl2gh/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs Exercises migration handler flows (generate/upload/import/cleanup).
src/OctoshiftCLI.Tests/gl2gh/Commands/MigrateRepo/MigrateRepoCommandArgsTests.cs Validates CLI argument combinations for migrate-repo.
src/OctoshiftCLI.Tests/gl2gh/Commands/InventoryReport/InventoryReportCommandTests.cs Ensures inventory report command wiring/options.
src/OctoshiftCLI.Tests/gl2gh/Commands/InventoryReport/InventoryReportCommandHandlerTests.cs Tests inventory report handler writes expected outputs.
src/OctoshiftCLI.Tests/gl2gh/Commands/GrantMigratorRole/GrantMigratorRoleCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/GenerateScript/GenerateScriptCommandTests.cs Ensures generate-script command wiring/options.
src/OctoshiftCLI.Tests/gl2gh/Commands/GenerateScript/GenerateScriptCommandHandlerTests.cs Validates script generation content/flags.
src/OctoshiftCLI.Tests/gl2gh/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs Validates argument validation rules for generate-script.
src/OctoshiftCLI.Tests/gl2gh/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/DownloadLogs/DownloadLogsCommandTests.cs Verifies backward-compat alias behavior for API URL option.
src/OctoshiftCLI.Tests/gl2gh/Commands/CreateTeam/CreateTeamCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.Tests/gl2gh/Commands/AbortMigration/AbortMigrationCommandTests.cs Ensures command options are wired correctly.
src/OctoshiftCLI.sln Adds gl2gh project to the solution.
src/OctoshiftCLI.IntegrationTests/GitlabToGithub.cs Adds GitLab-to-GitHub end-to-end integration test.
src/Octoshift/Services/GitlabClient.cs Introduces HTTP client wrapper for GitLab API calls (pagination, retries, downloads).
src/Octoshift/Services/GitlabApi.cs Adds GitLab API operations needed for export + inventory inspection.
src/Octoshift/Services/GithubClient.cs Adds GraphQL feature flag needed for GitLab migration support.
src/Octoshift/Services/GithubApi.cs Adds GitLab migration source + start-migration APIs.
src/Octoshift/Services/EnvironmentVariableProvider.cs Adds GITLAB_PAT secret retrieval support.
src/Octoshift/Models/GitlabProject.cs Adds shared GitLab project model used by inspection/reporting.
src/gl2gh/Services/ProjectsCsvGeneratorService.cs Implements projects.csv generation for GitLab inventory report.
src/gl2gh/Services/GroupsCsvGeneratorService.cs Implements groups.csv generation for GitLab inventory report.
src/gl2gh/Services/GitlabInspectorService.cs Adds cached inspection layer over GitLab API (groups/projects/MR counts).
src/gl2gh/Program.cs Adds extension entrypoint + DI setup + status/version checks.
src/gl2gh/gl2gh.csproj New gl2gh CLI project definition.
src/gl2gh/Factories/GitlabInspectorServiceFactory.cs Factory for inspector service creation/caching.
src/gl2gh/Factories/GitlabApiFactory.cs Factory for creating authenticated GitLab API instances (SSL/no-SSL).
src/gl2gh/ExportState.cs Defines export state helpers for GitLab export polling.
src/gl2gh/Commands/WaitForMigration/WaitForMigrationCommand.cs Adds wait-for-migration command wrapper.
src/gl2gh/Commands/RevokeMigratorRole/RevokeMigratorRoleCommand.cs Adds revoke-migrator-role command wrapper.
src/gl2gh/Commands/ReclaimMannequin/ReclaimMannequinCommand.cs Adds reclaim-mannequin command wrapper.
src/gl2gh/Commands/MigrateRepo/MigrateRepoCommandHandler.cs Implements GitLab export/download/upload/import orchestration.
src/gl2gh/Commands/MigrateRepo/MigrateRepoCommandArgs.cs Defines args and validation rules for migrate-repo.
src/gl2gh/Commands/MigrateRepo/MigrateRepoCommand.cs Defines the migrate-repo command/options and handler wiring.
src/gl2gh/Commands/InventoryReport/InventoryReportCommandHandler.cs Implements inventory report generation flow for GitLab.
src/gl2gh/Commands/InventoryReport/InventoryReportCommandArgs.cs Defines inventory report args.
src/gl2gh/Commands/InventoryReport/InventoryReportCommand.cs Defines inventory-report command/options and handler wiring.
src/gl2gh/Commands/GrantMigratorRole/GrantMigratorRoleCommand.cs Adds grant-migrator-role command wrapper.
src/gl2gh/Commands/GenerateScript/GenerateScriptCommandHandler.cs Generates PowerShell migration script for GitLab migrations.
src/gl2gh/Commands/GenerateScript/GenerateScriptCommandArgs.cs Defines args/validation for generate-script.
src/gl2gh/Commands/GenerateScript/GenerateScriptCommand.cs Defines generate-script command/options and handler wiring.
src/gl2gh/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommand.cs Adds generate-mannequin-csv command wrapper.
src/gl2gh/Commands/DownloadLogs/DownloadLogsCommand.cs Adds download-logs command wrapper + backward-compat alias.
src/gl2gh/Commands/CreateTeam/CreateTeamCommand.cs Adds create-team command wrapper.
src/gl2gh/Commands/AbortMigration/AbortMigrationCommand.cs Adds abort-migration command wrapper.
RELEASENOTES.md Adds release note entry for gl2gh.
README.md Documents gh gl2gh installation and basic usage.
publish.ps1 Publishes gl2gh binaries for supported platforms.
justfile Adds local run/watch/install helpers for gl2gh.
global.json Updates pinned .NET SDK version.
.github/workflows/integration-tests.yml Adds gl2gh to build artifacts and integration test matrix.
.github/workflows/CI.yml Adds gl2gh to build artifacts and e2e test matrix.
.devcontainer/devcontainer.json Adds .NET feature configuration for devcontainer.

Copilot's findings

  • Files reviewed: 63/63 changed files
  • Comments generated: 7

Comment thread src/gl2gh/Commands/MigrateRepo/MigrateRepoCommand.cs Outdated
Comment thread src/gl2gh/Commands/MigrateRepo/MigrateRepoCommand.cs Outdated
Comment thread src/gl2gh/Services/GroupsCsvGeneratorService.cs Outdated
Comment thread src/gl2gh/Services/GroupsCsvGeneratorService.cs Outdated
Comment thread src/gl2gh/Commands/MigrateRepo/MigrateRepoCommandHandler.cs
Comment thread src/gl2gh/Commands/GenerateScript/GenerateScriptCommandHandler.cs
Comment thread src/Octoshift/Services/GitlabApi.cs Outdated
@brianaj brianaj marked this pull request as ready for review May 28, 2026 03:42
Copy link
Copy Markdown
Contributor

@mulana mulana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍🏼

@github-actions
Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
gei 81% 73% 608
Octoshift 80% 70% 1974
gl2gh 77% 69% 413
ado2gh 71% 69% 741
bbs2gh 83% 78% 667
Summary 79% (8802 / 11164) 71% (2192 / 3071) 4403

@brianaj brianaj merged commit 1c162b0 into main May 28, 2026
38 checks passed
@brianaj brianaj deleted the add-gitlab-archive-adapter branch May 28, 2026 22:38
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.

6 participants