Skip to content

Commit

Permalink
Merge pull request #1325 from github/log-downloaded-archive-path-in-g…
Browse files Browse the repository at this point in the history
…ei-migrate-repo

Log the git and metadata archive paths after the download is complete
  • Loading branch information
ArinGhazarian authored Feb 3, 2025
2 parents 53020ff + c4b2d5b commit b8b7890
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@

- `gh gei migrate-repo` logs the git and metadata archive download paths when `--keep-archive` is used.
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ await _handler.Invoking(async x => await x.Handle(new MigrateRepoCommandArgs
}

[Fact]
public async Task Keep_Archive_Does_Not_Call_DeleteIfExists()
public async Task Keep_Archive_Does_Not_Call_DeleteIfExists_And_Logs_Downloaded_Archive_Paths()
{
_mockTargetGithubApi.Setup(x => x.GetOrganizationId(TARGET_ORG).Result).Returns(GITHUB_ORG_ID);
_mockTargetGithubApi.Setup(x => x.CreateGhecMigrationSource(GITHUB_ORG_ID).Result).Returns(MIGRATION_SOURCE_ID);
Expand Down Expand Up @@ -1737,6 +1737,9 @@ public async Task Keep_Archive_Does_Not_Call_DeleteIfExists()

_mockFileSystemProvider.Verify(x => x.DeleteIfExists(GIT_ARCHIVE_FILE_PATH), Times.Never);
_mockFileSystemProvider.Verify(x => x.DeleteIfExists(METADATA_ARCHIVE_FILE_PATH), Times.Never);

_mockOctoLogger.Verify(x => x.LogInformation($"Git archive was successfully downloaded at \"{GIT_ARCHIVE_FILE_PATH}\""));
_mockOctoLogger.Verify(x => x.LogInformation($"Metadata archive was successfully downloaded at \"{METADATA_ARCHIVE_FILE_PATH}\""));
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public MigrateRepoCommand() : base(

public Option<bool> KeepArchive { get; } = new("--keep-archive")
{
Description = "Keeps the archive on this machine after uploading to the blob storage account. Only applicable for migrations from GitHub Enterprise Server versions before 3.8.0."
Description = "Keeps the archive on this machine after uploading to the blob storage account. Only applicable for migrations from GitHub Enterprise Server versions before 3.8.0 or when used with --use-github-storage."
};

public override MigrateRepoCommandHandler BuildHandler(MigrateRepoCommandArgs args, IServiceProvider sp)
Expand Down
4 changes: 2 additions & 2 deletions src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ private string ExtractGhesBaseUrl(string ghesApiUrl)
{
_log.LogInformation($"Downloading archive from {gitArchiveUrl}");
await _httpDownloadService.DownloadToFile(gitArchiveUrl, gitArchiveDownloadFilePath);
_log.LogInformation("Download complete");
_log.LogInformation(keepArchive ? $"Git archive was successfully downloaded at \"{gitArchiveDownloadFilePath}\"" : "Download complete");

_log.LogInformation($"Downloading archive from {metadataArchiveUrl}");
await _httpDownloadService.DownloadToFile(metadataArchiveUrl, metadataArchiveDownloadFilePath);
_log.LogInformation("Download complete");
_log.LogInformation(keepArchive ? $"Metadata archive was successfully downloaded at \"{metadataArchiveDownloadFilePath}\"" : "Download complete");

return (
await UploadArchive(
Expand Down

0 comments on commit b8b7890

Please sign in to comment.