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

Add proxies for Azure Clients #1168

Open
wants to merge 2 commits into
base: release/2023.3
Choose a base branch
from

Conversation

IsaacCalligeros95
Copy link
Contributor

@IsaacCalligeros95 IsaacCalligeros95 commented Oct 20, 2023

This extends the addition of proxies in #1133 and #1149 to all Azure clients excluding ServiceFabric where our current version does not support adding httpClients or handlers.

@IsaacCalligeros95 IsaacCalligeros95 changed the title Isaac/add az proxies Add proxies for Azure Clients Oct 20, 2023

namespace Calamari.AzureCloudService
{
public class AuthHttpClientFactory
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's duplicated in this LTS branch but has been consolidated into Azure.CloudAccounts in master and is shared from there. As this is just the case for this LTS branch I wasn't too phased adding the additional class, it's what is there currently.

@@ -169,8 +172,8 @@ public async Task Deploy_Ensure_Tools_Are_Configured()
{
var serviceName = $"{nameof(DeployAzureCloudServiceCommandFixture)}-{Guid.NewGuid().ToString("N").Substring(0, 12)}";
var deploymentSlot = DeploymentSlot.Staging;

using var client = new ComputeManagementClient(subscriptionCloudCredentials);
var httpClientProxy = new AuthHttpClientFactory().GetHttpClient();
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems there is some inconsistency in how we get the client:

  • new AuthHttpClientFactory().GetHttpClient()
  • AuthHttpClientFactory.ProxyClientHandler()

How would someone know which to use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ComputeManagementClient only takes a httpClient while others take a httpClientHandler. the httpClientHandler looks to be the way moving forward.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines 256 to 261
// Note we aren't using Alphaleonis.Win32.Filesystem.Directory.EnumerateFiles which handles long file paths due to performance issues.
var parentDirectoryInfo = new DirectoryInfo(parentDirectoryPath);

return searchPatterns.Length == 0
? Alphaleonis.Win32.Filesystem.Directory.EnumerateFiles(parentDirectoryPath, "*", searchOption)
: searchPatterns.SelectMany(pattern =>
Alphaleonis.Win32.Filesystem.Directory.EnumerateFiles(parentDirectoryPath, pattern, searchOption));
? parentDirectoryInfo.GetFiles("*", searchOption).Select(fi => fi.FullName)
: searchPatterns.SelectMany(pattern => parentDirectoryInfo.GetFiles(pattern, searchOption).Select(fi => fi.FullName));
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems unrelated, should it be removed?

Copy link
Contributor

@benPearce1 benPearce1 left a comment

Choose a reason for hiding this comment

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

LGTM.
Consider removing the change in FileOperations.cs

@IsaacCalligeros95
Copy link
Contributor Author

LGTM. Consider removing the change in FileOperations.cs

Done, merged the latest for release/2023.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants