Skip to content

Commit

Permalink
Add an extra validation for when both AWS region and use github stora…
Browse files Browse the repository at this point in the history
…ge are provided
  • Loading branch information
ArinGhazarian committed Nov 7, 2024
1 parent 48e6469 commit 13c453e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@ public void It_Throws_If_Both_AwsBucketName_And_UseGithubStorage_Are_Provided()
.WithMessage("The --use-github-storage flag was provided with an AWS S3 Bucket name. Archive cannot be uploaded to both locations.");
}

[Fact]
public void It_Throws_If_Both_AwsRegion_And_UseGithubStorage_Are_Provided()
{
// Arrange
_args.AwsRegion = "aws-region";
_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 region. Archive cannot be uploaded to both locations.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public override void Validate(OctoLogger log)
throw new OctoshiftCliException("The --use-github-storage flag was provided with an AWS S3 Bucket name. Archive cannot be uploaded to both locations.");
}

if (AwsRegion.HasValue() && UseGithubStorage)
{
throw new OctoshiftCliException("The --use-github-storage flag was provided with an AWS S3 region. 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 13c453e

Please sign in to comment.