-
Notifications
You must be signed in to change notification settings - Fork 644
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
Migrate StatusAggregator job to MSI storage authentication #10328
base: dev
Are you sure you want to change the base?
Conversation
@@ -35,7 +35,7 @@ public Task CreateIfNotExistsAsync() | |||
public async Task<T> RetrieveAsync<T>(string rowKey) | |||
where T : class, ITableEntity | |||
{ | |||
return (await _table.GetEntityAsync<T>(TablePartitionKeys.Get<T>(), rowKey)) as T; | |||
return (await _table.GetEntityAsync<T>(TablePartitionKeys.Get<T>(), rowKey))?.Value as T; |
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 was broken since #10106
{ | ||
var blob = _container.GetBlobClient(name); | ||
return blob.UploadAsync(contents); | ||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents))) | ||
{ |
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.
Necessary to send content to correct method overload, otherwise an illegal character exception is thrown.
return new Uri(tempClient.Uri.GetLeftPart(UriPartial.Path)); | ||
} | ||
|
||
public static Uri GetPrimaryBlobServiceUri(string storageConnectionString) => GetPrimaryServiceUri(storageConnectionString); |
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.
Why need this function? can we cal 0GetPrimaryServiceUri
directly?
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.
+1, then we don't need mostly cosmetic changes in src/NuGet.Jobs.Common/StorageAccountExtensions.cs
public static Uri GetPrimaryBlobServiceUri(string storageConnectionString) => GetPrimaryServiceUri(storageConnectionString); | ||
|
||
|
||
public static Uri GetPrimaryTableServiceUri(string storageConnectionString) |
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.
Seems unused. Do we really need it?
{ | ||
var blob = _container.GetBlobClient(name); | ||
return blob.UploadAsync(contents); | ||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents))) |
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.
Could this Encoding.UTF8.GetBytes
safely handle data? If by “string” you mean we’ve forced arbitrary binary data into a .NET string (which can happen in edge cases, like reading a file with non-text bytes and interpreting them as characters), you can run into trouble.
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.
UTF-8 expects valid Unicode code points. If your data wasn’t actually text to begin with, we can end up with corruption or exceptions.
/// </summary> | ||
public string StorageAccount { get; set; } | ||
public string PrimaryStorageBlobEndpoint { get; set; } |
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 to make corresponding changes to NuGet.Deployment to match this change?
Addresses: https://github.com/NuGet/Engineering/issues/5447
This is 90% @advay26 (maybe more) and the rest me. :)
This change updates StatusAggregator to use MSIs for table storage access.