Skip to content

gl2gh migrate-repo: log message after successful migration gives incorrect log file URL for ghe.com targets #1612

Description

@FokkoVeegens

Description

When running gh gl2gh migrate-repo to migrate a GitLab repository to a GitHub data residency (ghe.com) target (--target-api-url and --target-uploads-url are supplied) the migrate-repo command itself prints a hint after the migration completes (or fails) suggesting how to re-fetch the migration log. The link in this hint is incorrect, because it doesn't take the target-api-url into account. The migrationLogUrl in this code snippet doesn't have the correct URL and needs to be fixed:

var (migrationState, _, warningsCount, failureReason, migrationLogUrl) = await _githubApi.GetMigration(migrationId);
while (RepositoryMigrationStatus.IsPending(migrationState))
{
_log.LogInformation($"Migration in progress (ID: {migrationId}). State: {migrationState}. Waiting 60 seconds...");
await Task.Delay(CHECK_MIGRATION_STATUS_DELAY_IN_MILLISECONDS);
(migrationState, _, warningsCount, failureReason, migrationLogUrl) = await _githubApi.GetMigration(migrationId);
}
var migrationLogAvailableMessage = $"Migration log available at {migrationLogUrl} or by running `gh {CliContext.RootCommand} download-logs --github-org {args.GithubOrg} --github-repo {args.GithubRepo}`";

The download-logs command itself works correctly when --target-api-url is supplied. If a user copies and runs the suggested command from the hint of migrate-repo as-is, it defaults to https://api.github.com instead of the tenant's ghe.com API endpoint, so it queries the wrong GitHub instance and fails to find (or returns an incorrect) migration log.

Reproduction Steps

Run a regular GitLab to GitHub ghe.com migration and try to open the logs from the CLI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions