Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept archive paths when using GitHub storage #1310

Merged
merged 12 commits into from
Dec 11, 2024

Conversation

synthead
Copy link
Collaborator

@synthead synthead commented Dec 5, 2024

Fixes https://github.ghe.com/github/octoshift/issues/9596!

This PR makes gh gei work with both of the following options which end up with uploading the archive:

  • --ghes-api-url: When migrating from a GHES instance directly.
  • --git-archive-path and --metadata-archive-path: When providing archive paths to upload prior to a migration.

Here's an example of its usage (note the absence of --ghes-api-url):

gh gei migrate-repo \
  --use-github-storage \
  --git-archive-path .misc/archives/migrations-testing-git.tar.gz \
  --metadata-archive-path .misc/archives/migrations-testing-metadata.tar.gz \
  --github-source-org migrations \
  --source-repo testing \
  --github-target-org import-testing \
  --target-repo "synthead-gei-gh-test-$(uuidgen)"

...and the resulting log output:

[2024-12-05 14:26:34] [INFO] SOURCE REPO: testing
[2024-12-05 14:26:34] [INFO] GITHUB TARGET ORG: import-testing
[2024-12-05 14:26:34] [INFO] TARGET REPO: synthead-gei-gh-test-4dfc0a1e-b62e-4039-9ae5-344a3669a778
[2024-12-05 14:26:34] [INFO] GIT ARCHIVE PATH: .misc/archives/migrations-testing-git.tar.gz
[2024-12-05 14:26:34] [INFO] METADATA ARCHIVE PATH: .misc/archives/migrations-testing-metadata.tar.gz
[2024-12-05 14:26:34] [INFO] USE GITHUB STORAGE: true
[2024-12-05 14:26:34] [INFO] Migrating Repo...
[2024-12-05 14:26:36] [INFO] Uploading archive 2024-12-05_14-26-36-git_archive.tar.gz to GitHub Storage
[2024-12-05 14:26:42] [INFO] Upload complete
[2024-12-05 14:26:42] [INFO] Uploading archive 2024-12-05_14-26-36-metadata_archive.tar.gz to GitHub Storage
[2024-12-05 14:26:43] [INFO] Upload complete
[2024-12-05 14:26:43] [INFO] Archive(s) uploaded to blob storage, now starting migration...
  • 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 synthead self-assigned this Dec 5, 2024
Copy link

github-actions bot commented Dec 5, 2024

Unit Test Results

853 tests   853 ✅  20s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 3c678c5.

♻️ This comment has been updated with latest results.

src/gei/Commands/MigrateRepo/MigrateRepoCommandArgs.cs Outdated Show resolved Hide resolved
RELEASENOTES.md Outdated Show resolved Hide resolved
@ArinGhazarian
Copy link
Collaborator

Not sure if we want to fix it as part of this PR, but I noticed that we have some validations for when the --ghes-api-url is provided but with the addition of the archive paths scenario we totally skip them! so in that case we also need to run those checks. To avoid confusion we can rename the method from ValidateGHESOption to ValidateUploadOptions.

@synthead
Copy link
Collaborator Author

Not sure if we want to fix it as part of this PR, but I noticed that we have some validations for when the --ghes-api-url is provided but with the addition of the archive paths scenario we totally skip them! so in that case we also need to run those checks. To avoid confusion we can rename the method from ValidateGHESOption to ValidateUploadOptions.

Added in 5c4a21a!

Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
gei 81% 72% 592
ado2gh 84% 78% 631
Octoshift 87% 76% 1344
bbs2gh 79% 74% 692
Summary 84% (7175 / 8562) 75% (1656 / 2206) 3259

@ArinGhazarian ArinGhazarian self-assigned this Dec 11, 2024
Copy link

@iomekam iomekam left a comment

Choose a reason for hiding this comment

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

LGTM!

@ArinGhazarian ArinGhazarian merged commit 20bbba7 into main Dec 11, 2024
30 checks passed
@ArinGhazarian ArinGhazarian deleted the accept-archive-paths-with-github-storage-in-gei branch December 11, 2024 23:32
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.

3 participants