Skip to content

Commit f2f44ec

Browse files
authored
[Rollout] Production rollout 2025-02-14 (#4458)
<!-- Link the GitHub or AzDO issue this pull request is associated with. Please copy and paste the full URL rather than using the dotnet/arcade-services# syntax --> #4459
2 parents 70678e7 + 984a3da commit f2f44ec

File tree

12 files changed

+152
-263
lines changed

12 files changed

+152
-263
lines changed

eng/Version.Details.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@
5959
</Dependency>
6060
</ProductDependencies>
6161
<ToolsetDependencies>
62-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.25105.2">
62+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.25111.4">
6363
<Uri>https://github.com/dotnet/arcade</Uri>
64-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
64+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
6565
</Dependency>
66-
<Dependency Name="Microsoft.DotNet.SignTool" Version="8.0.0-beta.25105.2">
66+
<Dependency Name="Microsoft.DotNet.SignTool" Version="8.0.0-beta.25111.4">
6767
<Uri>https://github.com/dotnet/arcade</Uri>
68-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
68+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
6969
</Dependency>
70-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="8.0.0-beta.25105.2">
70+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="8.0.0-beta.25111.4">
7171
<Uri>https://github.com/dotnet/arcade</Uri>
72-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
72+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
7373
</Dependency>
74-
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="8.0.0-beta.25105.2">
74+
<Dependency Name="Microsoft.DotNet.SwaggerGenerator.MSBuild" Version="8.0.0-beta.25111.4">
7575
<Uri>https://github.com/dotnet/arcade</Uri>
76-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
76+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
7777
</Dependency>
78-
<Dependency Name="Microsoft.DotNet.Git.IssueManager" Version="8.0.0-beta.25105.2">
78+
<Dependency Name="Microsoft.DotNet.Git.IssueManager" Version="8.0.0-beta.25111.4">
7979
<Uri>https://github.com/dotnet/arcade</Uri>
80-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
80+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
8181
</Dependency>
82-
<Dependency Name="Microsoft.DotNet.VersionTools" Version="8.0.0-beta.25105.2">
82+
<Dependency Name="Microsoft.DotNet.VersionTools" Version="8.0.0-beta.25111.4">
8383
<Uri>https://github.com/dotnet/arcade</Uri>
84-
<Sha>f9e274e2269d2cda748e78344afe681411748157</Sha>
84+
<Sha>a319ada170a54ee87c7a81e3309948e3d3ea7aca</Sha>
8585
</Dependency>
8686
<Dependency Name="Microsoft.DncEng.SecretManager" Version="1.1.0-beta.25105.1">
8787
<Uri>https://github.com/dotnet/dnceng</Uri>

eng/Versions.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
1010
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.0-preview.1</MicrosoftNetFrameworkReferenceAssembliesVersion>
1111
<!-- Libs -->
12-
<MicrosoftDotNetSignToolVersion>8.0.0-beta.25105.2</MicrosoftDotNetSignToolVersion>
13-
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.25105.2</MicrosoftDotNetBuildTasksFeedVersion>
14-
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>8.0.0-beta.25105.2</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
15-
<MicrosoftDotNetGitIssueManagerVersion>8.0.0-beta.25105.2</MicrosoftDotNetGitIssueManagerVersion>
16-
<MicrosoftDotNetVersionToolsVersion>8.0.0-beta.25105.2</MicrosoftDotNetVersionToolsVersion>
12+
<MicrosoftDotNetSignToolVersion>8.0.0-beta.25111.4</MicrosoftDotNetSignToolVersion>
13+
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.25111.4</MicrosoftDotNetBuildTasksFeedVersion>
14+
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>8.0.0-beta.25111.4</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
15+
<MicrosoftDotNetGitIssueManagerVersion>8.0.0-beta.25111.4</MicrosoftDotNetGitIssueManagerVersion>
16+
<MicrosoftDotNetVersionToolsVersion>8.0.0-beta.25111.4</MicrosoftDotNetVersionToolsVersion>
1717
<MicrosoftNetTestSdkVersion>17.4.1</MicrosoftNetTestSdkVersion>
1818
<MicrosoftDotNetInternalLoggingVersion>1.1.0-beta.25111.1</MicrosoftDotNetInternalLoggingVersion>
1919
<MicrosoftAspNetCoreApiPaginationVersion>1.1.0-beta.25111.1</MicrosoftAspNetCoreApiPaginationVersion>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
}
1616
},
1717
"msbuild-sdks": {
18-
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25105.2"
18+
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25111.4"
1919
}
2020
}

src/ProductConstructionService/Microsoft.DotNet.ProductConstructionService.Client/ProductConstructionServiceApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ partial void HandleFailedRequest(RestApiException ex)
4444
}
4545
else if (ex.Response.Status == (int)HttpStatusCode.Unauthorized)
4646
{
47-
throw new AuthenticationException("Unauthorized access while trying to access Maestro API. " +
48-
"Please make sure the PAT you're using is valid.");
47+
throw new AuthenticationException("Unauthorized access while trying to use Maestro API. " +
48+
"Make sure your darc client is authenticated. More details: https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md");
4949
}
5050
}
5151

src/ProductConstructionService/ProductConstructionService.Api/Api/v2018_07_16/Controllers/SubscriptionsController.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private async Task EnqueueUpdateSubscriptionWorkItemAsync(Guid subscriptionId, i
171171
else
172172
{
173173
// Update using the latest build
174-
subscriptionToUpdate =
174+
var subscriptionAndBuild =
175175
(from sub in _context.Subscriptions
176176
where sub.Id == subscriptionId
177177
let latestBuild =
@@ -180,7 +180,13 @@ private async Task EnqueueUpdateSubscriptionWorkItemAsync(Guid subscriptionId, i
180180
.OrderByDescending(b => b.DateProduced)
181181
.FirstOrDefault()
182182
where latestBuild != null
183-
select sub).SingleOrDefault();
183+
select new
184+
{
185+
subscription = sub,
186+
latestBuildId = latestBuild.Id
187+
}).SingleOrDefault();
188+
subscriptionToUpdate = subscriptionAndBuild?.subscription;
189+
buildId = subscriptionAndBuild?.latestBuildId ?? 0;
184190
}
185191

186192
if (subscriptionToUpdate != null)

src/ProductConstructionService/ProductConstructionService.Api/Configuration/SubscriptionTriggerConfiguration.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public static void TriggerSubscriptionOnNewBuild(IInsertedEntry<BuildChannel, Db
2020
var workItemProducerFactory = context.GetService<IWorkItemProducerFactory>();
2121
BuildChannel entity = entry.Entity;
2222

23+
logger.LogInformation("Build {buildId} was added to channel {channelId}. Triggering corresponding subscriptions.",
24+
entity.BuildId,
25+
entity.ChannelId);
26+
2327
Build? build = context.Builds
2428
.Include(b => b.Assets)
2529
.ThenInclude(a => a.Locations)
@@ -34,12 +38,6 @@ public static void TriggerSubscriptionOnNewBuild(IInsertedEntry<BuildChannel, Db
3438
var hasAssetsWithPublishedLocations = build.Assets
3539
.Any(a => a.Locations.Any(al => al.Type != LocationType.None && !al.Location.EndsWith("/artifacts")));
3640

37-
if (!hasAssetsWithPublishedLocations)
38-
{
39-
logger.LogInformation("Skipping Dependency update for Build {buildId} because it contains no assets in valid locations", entity.BuildId);
40-
return;
41-
}
42-
4341
var subscriptionsToUpdate = context.Subscriptions
4442
.Where(sub =>
4543
sub.Enabled &&
@@ -50,6 +48,18 @@ public static void TriggerSubscriptionOnNewBuild(IInsertedEntry<BuildChannel, Db
5048

5149
foreach (Subscription subscription in subscriptionsToUpdate)
5250
{
51+
if (!hasAssetsWithPublishedLocations && !subscription.SourceEnabled)
52+
{
53+
logger.LogInformation("Skipping subscription {subscriptionId} triggering for Build {buildId} because the build has no assets and the subscription is not source enabled",
54+
subscription.Id,
55+
entity.BuildId);
56+
continue;
57+
}
58+
59+
logger.LogInformation("Triggering subscription {subscriptionId} with build {buildId}",
60+
subscription.Id,
61+
entity.BuildId);
62+
5363
var workItemProducer = workItemProducerFactory.CreateProducer<SubscriptionTriggerWorkItem>(subscription.SourceEnabled);
5464
workItemProducer.ProduceWorkItemAsync(new()
5565
{

src/ProductConstructionService/ProductConstructionService.FeedCleaner/FeedCleaner.cs

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
using Microsoft.EntityFrameworkCore;
1111
using Microsoft.Extensions.Logging;
1212

13-
using PackagesInReleaseFeeds = System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<string, System.Collections.Generic.HashSet<string>>>;
14-
1513
namespace ProductConstructionService.FeedCleaner;
1614

1715
public class FeedCleaner
@@ -24,15 +22,16 @@ public class FeedCleaner
2422
public FeedCleaner(
2523
IAzureDevOpsClient azureDevOpsClient,
2624
BuildAssetRegistryContext context,
25+
IHttpClientFactory httpClientFactory,
2726
ILogger<FeedCleaner> logger)
2827
{
2928
_azureDevOpsClient = azureDevOpsClient;
3029
_context = context;
3130
_logger = logger;
32-
_httpClient = new HttpClient(new HttpClientHandler() { CheckCertificateRevocationList = true });
31+
_httpClient = httpClientFactory.CreateClient();
3332
}
3433

35-
public async Task CleanFeedAsync(AzureDevOpsFeed feed, PackagesInReleaseFeeds packagesInReleaseFeeds)
34+
public async Task CleanFeedAsync(AzureDevOpsFeed feed)
3635
{
3736
try
3837
{
@@ -44,10 +43,10 @@ public async Task CleanFeedAsync(AzureDevOpsFeed feed, PackagesInReleaseFeeds pa
4443

4544
foreach (var package in packages)
4645
{
47-
HashSet<string> updatedVersions = await UpdateReleasedVersionsForPackageAsync(feed, package, packagesInReleaseFeeds);
46+
HashSet<Asset> updatedAssets = await UpdateReleasedVersionsForPackageAsync(feed, package);
4847

49-
await DeletePackageVersionsFromFeedAsync(feed, package.Name, updatedVersions);
50-
updatedCount += updatedVersions.Count;
48+
await DeletePackageVersionsFromFeedAsync(feed, updatedAssets);
49+
updatedCount += updatedAssets.Count;
5150
}
5251

5352
_logger.LogInformation("Feed {feed} cleaning finished with {count}/{totalCount} updated packages", feed.Name, updatedCount, packages.Count);
@@ -74,12 +73,11 @@ public async Task CleanFeedAsync(AzureDevOpsFeed feed, PackagesInReleaseFeeds pa
7473
/// <param name="package">Package to search for</param>
7574
/// <param name="dotnetFeedsPackageMapping">Mapping of packages and their versions in the release feeds</param>
7675
/// <returns>Collection of versions that were updated for the package</returns>
77-
private async Task<HashSet<string>> UpdateReleasedVersionsForPackageAsync(
76+
private async Task<HashSet<Asset>> UpdateReleasedVersionsForPackageAsync(
7877
AzureDevOpsFeed feed,
79-
AzureDevOpsPackage package,
80-
PackagesInReleaseFeeds dotnetFeedsPackageMapping)
78+
AzureDevOpsPackage package)
8179
{
82-
var releasedVersions = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
80+
HashSet<Asset> releasedAssets = new();
8381

8482
foreach (var version in package.Versions)
8583
{
@@ -101,119 +99,97 @@ private async Task<HashSet<string>> UpdateReleasedVersionsForPackageAsync(
10199
continue;
102100
}
103101

104-
if (matchingAsset.Locations.Any(l => l.Location == FeedConstants.NuGetOrgLocation ||
105-
dotnetFeedsPackageMapping.Any(f => l.Location == f.Key)))
102+
if (matchingAsset.Locations.Any(l => l.Location == FeedConstants.NuGetOrgLocation))
106103
{
107104
_logger.LogInformation("Package {package}.{version} is already present in a public location.",
108105
package.Name,
109106
version.Version);
110-
releasedVersions.Add(version.Version);
107+
releasedAssets.Add(matchingAsset);
111108
continue;
112109
}
113110

114-
List<string> feedsWherePackageIsAvailable = GetReleaseFeedsWherePackageIsAvailable(
115-
package.Name,
116-
version.Version,
117-
dotnetFeedsPackageMapping);
118-
119111
try
120112
{
121-
if (await IsPackageAvailableInNugetOrgAsync(package.Name, version.Version))
113+
if (!await IsPackageAvailableInNugetOrgAsync(package.Name, version.Version))
122114
{
123-
feedsWherePackageIsAvailable.Add(FeedConstants.NuGetOrgLocation);
115+
_logger.LogInformation("Package {package}.{version} not found in any of the release feeds", package.Name, version);
116+
continue;
124117
}
125118
}
126119
catch (HttpRequestException e)
127120
{
128121
_logger.LogWarning(e, "Failed to determine if package {package}.{version} is present in NuGet.org",
129122
package.Name,
130123
version.Version);
131-
}
132-
133-
if (feedsWherePackageIsAvailable.Count <= 0)
134-
{
135-
_logger.LogInformation("Package {package}.{version} not found in any of the release feeds", package.Name, version);
136124
continue;
137125
}
138126

139-
releasedVersions.Add(version.Version);
140-
foreach (string feedToAdd in feedsWherePackageIsAvailable)
141-
{
142-
_logger.LogInformation("Found package {package}.{version} in {feed}, adding location to asset",
143-
package.Name,
144-
version.Version,
145-
feedToAdd);
127+
releasedAssets.Add(matchingAsset);
146128

147-
matchingAsset.Locations.Add(new AssetLocation()
148-
{
149-
Location = feedToAdd,
150-
Type = LocationType.NugetFeed
151-
});
129+
_logger.LogInformation("Found package {package}.{version} in {feed}, adding location to asset",
130+
package.Name,
131+
version.Version,
132+
FeedConstants.NuGetOrgLocation);
152133

153-
await _context.SaveChangesAsync();
154-
}
134+
matchingAsset.Locations.Add(new AssetLocation()
135+
{
136+
Location = FeedConstants.NuGetOrgLocation,
137+
Type = LocationType.NugetFeed
138+
});
139+
140+
await _context.SaveChangesAsync();
155141
}
156142

157-
return releasedVersions;
143+
return releasedAssets;
158144
}
159145

160146
/// <summary>
161147
/// Deletes a version of a package from an Azure DevOps feed
162148
/// </summary>
163149
/// <param name="feed">Feed to delete the package from</param>
164150
/// <param name="packageName">package to delete</param>
165-
/// <param name="versionsToDelete">Collection of versions to delete</param>
151+
/// <param name="assetsToDelete">Collection of versions to delete</param>
166152
private async Task DeletePackageVersionsFromFeedAsync(
167153
AzureDevOpsFeed feed,
168-
string packageName,
169-
HashSet<string> versionsToDelete)
154+
HashSet<Asset> assetsToDelete)
170155
{
171-
foreach (string version in versionsToDelete)
156+
foreach (Asset asset in assetsToDelete)
172157
{
173158
try
174159
{
175160
_logger.LogInformation("Deleting package {package}.{version} from feed {feed}",
176-
packageName, version, feed.Name);
161+
asset.Name, asset.Version, feed.Name);
177162

178163
await _azureDevOpsClient.DeleteNuGetPackageVersionFromFeedAsync(
179164
feed.Account,
180165
feed.Project?.Name,
181166
feed.Name,
182-
packageName,
183-
version);
167+
asset.Name,
168+
asset.Version);
169+
170+
var assetLocation = asset.Locations.FirstOrDefault(al => al.Location.Contains(feed.Name, StringComparison.OrdinalIgnoreCase));
171+
if (assetLocation != null)
172+
{
173+
asset.Locations.Remove(assetLocation);
174+
}
184175
}
185176
catch (HttpRequestException e)
186177
{
187178
_logger.LogError(e, "There was an error attempting to delete package {package}.{version} from the {feed} feed. Skipping...",
188-
packageName,
189-
version,
179+
asset.Name,
180+
asset.Version,
190181
feed.Name);
191182
}
192183
}
193-
}
194184

195-
/// <summary>
196-
/// Gets a list of feeds where a given package is available
197-
/// </summary>
198-
/// <param name="name">Package to search for</param>
199-
/// <param name="version">Version to search for</param>
200-
/// <param name="packageMappings">Feeds to search</param>
201-
/// <returns>List of feeds in the package mappings where the provided package and version are available</returns>
202-
private static List<string> GetReleaseFeedsWherePackageIsAvailable(
203-
string name,
204-
string version,
205-
PackagesInReleaseFeeds packageMappings)
206-
{
207-
List<string> feeds = [];
208-
foreach ((string feedName, Dictionary<string, HashSet<string>> packages) in packageMappings)
185+
try
209186
{
210-
if (packages.TryGetValue(name, out HashSet<string>? versions) && versions.Contains(version))
211-
{
212-
feeds.Add(feedName);
213-
}
187+
await _context.SaveChangesAsync();
188+
}
189+
catch (Exception e)
190+
{
191+
_logger.LogError(e, "Failed to remove location {feed} from Assets in BAR", feed.Name);
214192
}
215-
216-
return feeds;
217193
}
218194

219195
/// <summary>

src/ProductConstructionService/ProductConstructionService.FeedCleaner/FeedCleanerConfiguration.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ public static void ConfigureFeedCleaner(this IHostApplicationBuilder builder, IT
3434
builder.Services.AddTransient<IAzureDevOpsClient, AzureDevOpsClient>();
3535
builder.Services.AddTransient<ILogger>(sp => sp.GetRequiredService<ILogger<FeedCleanerJob>>());
3636
builder.Services.AddTransient<IProcessManager>(sp => ActivatorUtilities.CreateInstance<ProcessManager>(sp, "git"));
37+
builder.Services.AddHttpClient().ConfigureHttpClientDefaults(builder =>
38+
{
39+
builder.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
40+
{
41+
CheckCertificateRevocationList = true,
42+
});
43+
});
3744

3845
builder.Services.AddTransient<FeedCleanerJob>();
3946
builder.Services.AddTransient<FeedCleaner>();

0 commit comments

Comments
 (0)