diff --git a/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs b/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs index 2064072d..e45ba5a5 100644 --- a/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs +++ b/src/OctoshiftCLI.Tests/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs @@ -34,4 +34,19 @@ public void Invoke_With_Ssh_Port_Set_To_7999_Logs_Warning() _mockOctoLogger.Verify(x => x.LogWarning(It.Is(x => x.ToLower().Contains("--ssh-port is set to 7999")))); } + + [Fact] + public void It_Throws_If_Both_AwsBucketName_And_UseGithubStorage_Are_Provided() + { + // Arrange + _args.AwsBucketName = "my-bucket"; + _args.UseGithubStorage = true; + + // Act & Assert + _args.Invoking(x => x.Validate(_mockOctoLogger.Object)) + .Should() + .ThrowExactly() + .WithMessage("The --use-github-storage flag was provided with an AWS S3 Bucket name. Archive cannot be uploaded to both locations."); + } + } diff --git a/src/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgs.cs b/src/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgs.cs index c6b653d3..07415d9d 100644 --- a/src/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgs.cs +++ b/src/bbs2gh/Commands/GenerateScript/GenerateScriptCommandArgs.cs @@ -36,6 +36,11 @@ public override void Validate(OctoLogger log) throw new OctoshiftCliException("--no-ssl-verify can only be provided with --bbs-server-url."); } + if (!string.IsNullOrWhiteSpace(AwsBucketName) && UseGithubStorage) + { + throw new OctoshiftCliException("The --use-github-storage flag was provided with an AWS S3 Bucket name. Archive cannot be uploaded to both locations."); + } + if (SshPort == 7999) { log?.LogWarning("--ssh-port is set to 7999, which is the default port that Bitbucket Server and Bitbucket Data Center use for Git operations over SSH. This is probably the wrong value, because --ssh-port should be configured with the SSH port used to manage the server where Bitbucket Server/Bitbucket Data Center is running, not the port used for Git operations over SSH.");