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

PART1: Add use-github-storage option #1269

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void Should_Have_Options()
var command = new MigrateRepoCommand();
command.Should().NotBeNull();
command.Name.Should().Be("migrate-repo");
command.Options.Count.Should().Be(31);
command.Options.Count.Should().Be(32);

TestHelpers.VerifyCommandOption(command.Options, "bbs-server-url", true);
TestHelpers.VerifyCommandOption(command.Options, "bbs-project", true);
Expand Down Expand Up @@ -88,6 +88,7 @@ public void Should_Have_Options()
TestHelpers.VerifyCommandOption(command.Options, "keep-archive", false);
TestHelpers.VerifyCommandOption(command.Options, "no-ssl-verify", false);
TestHelpers.VerifyCommandOption(command.Options, "target-api-url", false);
TestHelpers.VerifyCommandOption(command.Options, "use-github-storage", false, true);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Should_Have_Options()

command.Should().NotBeNull();
command.Name.Should().Be("migrate-repo");
command.Options.Count.Should().Be(23);
command.Options.Count.Should().Be(24);

TestHelpers.VerifyCommandOption(command.Options, "github-source-org", true);
TestHelpers.VerifyCommandOption(command.Options, "source-repo", true);
Expand All @@ -37,6 +37,7 @@ public void Should_Have_Options()
TestHelpers.VerifyCommandOption(command.Options, "github-target-pat", false);
TestHelpers.VerifyCommandOption(command.Options, "verbose", false);
TestHelpers.VerifyCommandOption(command.Options, "keep-archive", false);
TestHelpers.VerifyCommandOption(command.Options, "use-github-storage", false, true);
}
}
}
5 changes: 5 additions & 0 deletions src/bbs2gh/Commands/MigrateRepo/MigrateRepoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public MigrateRepoCommand() : base(
AddOption(KeepArchive);
AddOption(NoSslVerify);
AddOption(TargetApiUrl);
AddOption(UseGithubStorage);
}

public Option<string> BbsServerUrl { get; } = new(
Expand Down Expand Up @@ -191,6 +192,10 @@ public MigrateRepoCommand() : base(
name: "--no-ssl-verify",
description: "Disables SSL verification when communicating with your Bitbucket Server/Data Center instance. All other migration steps will continue to verify SSL. " +
"If your Bitbucket instance has a self-signed SSL certificate then setting this flag will allow the migration archive to be exported.");
public Option<bool> UseGithubStorage { get; } = new(
Copy link
Collaborator

Choose a reason for hiding this comment

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

UseGithubStorage property also needs to be added to MigrateRepoCommandArgs plus some validations. For example it cannot be provide with both Azure storage connection string or AWS s3 stuff.

name: "--use-github-storage",
description: "Enables multipart uploads to a GitHub owned storage for use during migration")
{ IsHidden = true };

public override MigrateRepoCommandHandler BuildHandler(MigrateRepoCommandArgs args, IServiceProvider sp)
{
Expand Down
6 changes: 6 additions & 0 deletions src/gei/Commands/MigrateRepo/MigrateRepoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public MigrateRepoCommand() : base(
AddOption(GithubTargetPat);
AddOption(Verbose);
AddOption(KeepArchive);
AddOption(UseGithubStorage);
}

public Option<string> GithubSourceOrg { get; } = new("--github-source-org")
Expand Down Expand Up @@ -102,6 +103,11 @@ public MigrateRepoCommand() : base(
{
Description = "Only effective if migrating from GHES. Disables SSL verification when communicating with your GHES instance. All other migration steps will continue to verify SSL. If your GHES instance has a self-signed SSL certificate then setting this flag will allow data to be extracted."
};
public Option<bool> UseGithubStorage { get; } = new("--use-github-storage")
begonaguereca marked this conversation as resolved.
Show resolved Hide resolved
{
IsHidden = true,
Description = "Enables multipart uploads to a GitHub owned storage for use during migration",
};

// Pre-uploaded archive urls, hidden by default
public Option<string> GitArchiveUrl { get; } = new("--git-archive-url")
Expand Down