Skip to content

Commit

Permalink
Add check with AWS storgae
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaguereca committed Nov 6, 2024
1 parent e673ced commit 30350b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@ public void Invoke_With_Ssh_Port_Set_To_7999_Logs_Warning()

_mockOctoLogger.Verify(x => x.LogWarning(It.Is<string>(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<OctoshiftCliException>()
.WithMessage("The --use-github-storage flag was provided with an AWS S3 Bucket name. Archive cannot be uploaded to both locations.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down

0 comments on commit 30350b1

Please sign in to comment.