gh-gei icon indicating copy to clipboard operation
gh-gei copied to clipboard

`gh gei generate-script --download-migration-logs` tries to download logs even when the migration wasn't started

Open timrogers opened this issue 2 years ago • 0 comments

Description

gh gei generate-script's --download-migration-logs allows you to generate a migration script which downloads the logs to the local machine at the end of the migrations.

At the moment, if the migration doesn't get started (for example because of our "does the target repo already exist?" check), we still try to download the migration logs at the end. We shouldn't do this, because we already know that there won't be any migration logs.

You end up with output like this:

[13:11] [INFO] You are running the latest version of the gei CLI [v0.34]
[13:11] [INFO] Migrating Repo...
[13:11] [INFO] GITHUB SOURCE ORG: caffeinesoftware
[13:11] [INFO] SOURCE REPO: autolinks-example
[13:11] [INFO] GITHUB TARGET ORG: caffeinesoftware
[13:11] [INFO] TARGET REPO: autolinks-example
[13:11] [WARNING] The Org 'caffeinesoftware' already contains a repository with the name 'autolinks-example'. No operation will be performed
[13:11] [INFO] You are running the latest version of the gei CLI [v0.34]
[13:11] [WARNING] Migration logs are only available for 24 hours after a migration finishes!
[13:11] [INFO] Downloading migration logs...
[13:11] [INFO] GITHUB ORG: caffeinesoftware
[13:11] [INFO] GITHUB REPO: autolinks-example
[13:11] [ERROR] Migration for repository autolinks-example not found!

Reproduction Steps

Generate a script with the --download-migration-logs option which runs a migration where the source and destination are the same. This guarantees that the "does the target repo already exist?" check returns true, and that no migrations start, e.g.:

gh gei generate-script --github-source-org caffeinesoftware --github-target-org caffeinesoftware --download-migration-logs
pwsh migrate.ps1

timrogers avatar Mar 06 '23 13:03 timrogers