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

Remove useGithubStorage from GHES version checker method #1293

Closed
wants to merge 6 commits into from

Conversation

begonaguereca
Copy link
Collaborator

@begonaguereca begonaguereca commented Nov 7, 2024

This pull request simplifies the method calls to AreBlobCredentialsRequired by removing the boolean parameter that checks for gitHubOwnedStorage.

While this produces the correct result, it is confusing for a reader. This PR refactors out that logic and adds the checks in the correct spots.

  • 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)

Copy link

github-actions bot commented Nov 7, 2024

Unit Test Results

829 tests   829 ✅  21s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 8774121.

♻️ This comment has been updated with latest results.

@begonaguereca begonaguereca changed the title Bug Remove useGithubStorage from GHES version checker method Nov 7, 2024
@begonaguereca begonaguereca marked this pull request as ready for review November 7, 2024 16:31
@@ -407,7 +409,7 @@
return;
}

if (!shouldUseAzureStorage && !shouldUseAwsS3 && !args.UseGithubStorage)
if (!shouldUseAzureStorage && !shouldUseAwsS3 && !args.UseGithubStorage && !cloudCredentialsRequired)

Check warning

Code scanning / CodeQL

Constant condition Warning

Condition always evaluates to 'true'.
Comment on lines +67 to +69
var are_blob_credentials_required_based_on_ghes_version = await _ghesVersionChecker.AreBlobCredentialsRequired(args.GhesApiUrl);
var blobCredentialsRequired = !args.UseGithubStorage || are_blob_credentials_required_based_on_ghes_version;
var blobStorageUsed = args.UseGithubStorage || are_blob_credentials_required_based_on_ghes_version;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The previous logic was good. We need to always check the GHES version to be able to find out if it's > 3.8 or not. The only thing is that AreBlobCredentialsRequred doesn't need to know about the use github storage.

@@ -396,7 +398,7 @@ private void ValidateGHESOptions(MigrateRepoCommandArgs args, bool cloudCredenti

if (args.UseGithubStorage)
{
_log.LogWarning("Ignoring --use-github-storage flag because you are running GitHub Enterprise Server (GHES) 3.8.0 or later. The blob storage credentials configured in your GHES Management Console will be used instead.");
_log.LogWarning("Provding the --use-github-storage flag will supersede any credentials you have configured in your GitHub Enterprise Server (GHES) Management Console.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that this logic is good. To be 100% though, I would recommend testing against GHES > 3.8 by configuring the creds in the management console + providing the --use-github-storage to verify.

Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
gei 79% 70% 554
ado2gh 84% 78% 627
Octoshift 87% 76% 1298
bbs2gh 79% 74% 666
Summary 83% (7010 / 8409) 75% (1579 / 2102) 3145

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.

2 participants