From 3c28317bdc0cea8035a624af303bc653bd7d56e3 Mon Sep 17 00:00:00 2001 From: Arin Ghazarian Date: Fri, 24 Jan 2025 18:48:40 -0800 Subject: [PATCH 1/3] Log the git and metadata archive paths after the download is complete --- src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs | 2 +- src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs b/src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs index a0ce2d47..c940ed24 100644 --- a/src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs +++ b/src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs @@ -150,7 +150,7 @@ public MigrateRepoCommand() : base( public Option 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) diff --git a/src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs b/src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs index 10192d3a..07219751 100644 --- a/src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs +++ b/src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs @@ -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( From 6fd1ccfe8159b3e66cd9c7030a2c3bbc9464a8aa Mon Sep 17 00:00:00 2001 From: Arin Ghazarian Date: Fri, 24 Jan 2025 18:52:10 -0800 Subject: [PATCH 2/3] Add release note --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8b137891..102e2fe3 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1 +1 @@ - +- `gh gei migrate-repo` logs the git and metadata archive download paths when `--keep-archive` is used. \ No newline at end of file From c4b2d5b7f7fa3a90d690733885152a353a6f3bcc Mon Sep 17 00:00:00 2001 From: Arin Ghazarian Date: Fri, 31 Jan 2025 16:51:32 -0800 Subject: [PATCH 3/3] Modify keep archive test to verify downloaded archive paths --- .../Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs b/src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs index a8836c91..f6e37299 100644 --- a/src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs +++ b/src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs @@ -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); @@ -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]