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
base: release/2023.3
Are you sure you want to change the base?
Conversation
fbac30c
to
7c23c04
Compare
…ent setters are provided
7c23c04
to
44e6351
Compare
|
||
namespace Calamari.AzureCloudService | ||
{ | ||
public class AuthHttpClientFactory |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// 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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
Done, merged the latest for release/2023.3 |
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.