Skip to content

Commit 83dd68a

Browse files
authored
[Rollout] Production rollout 2025-05-08 (#4818)
#4817
2 parents fcf0bae + 7af7ce5 commit 83dd68a

File tree

27 files changed

+115
-966
lines changed

27 files changed

+115
-966
lines changed

arcade-services.sln

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{02EA681E
9494
EndProject
9595
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProductConstructionService.ReproTool", "tools\ProductConstructionService.ReproTool\ProductConstructionService.ReproTool.csproj", "{261CB211-6023-8025-48E1-D11953F4C61C}"
9696
EndProject
97-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlatFlowMigrationCli", "tools\FlatFlowMigrationCli\FlatFlowMigrationCli.csproj", "{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}"
98-
EndProject
9997
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Common", "tools\Tools.Common\Tools.Common.csproj", "{977060F4-EEEF-420D-02E8-5E58D3E51942}"
10098
EndProject
10199
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersionPropsFormatter", "tools\VersionPropsFormatter\VersionPropsFormatter.csproj", "{40B3EEE3-2B38-4264-A32F-173D129090F8}"
@@ -508,18 +506,6 @@ Global
508506
{261CB211-6023-8025-48E1-D11953F4C61C}.Release|x64.Build.0 = Release|Any CPU
509507
{261CB211-6023-8025-48E1-D11953F4C61C}.Release|x86.ActiveCfg = Release|Any CPU
510508
{261CB211-6023-8025-48E1-D11953F4C61C}.Release|x86.Build.0 = Release|Any CPU
511-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
512-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
513-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|x64.ActiveCfg = Debug|Any CPU
514-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|x64.Build.0 = Debug|Any CPU
515-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|x86.ActiveCfg = Debug|Any CPU
516-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Debug|x86.Build.0 = Debug|Any CPU
517-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
518-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|Any CPU.Build.0 = Release|Any CPU
519-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|x64.ActiveCfg = Release|Any CPU
520-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|x64.Build.0 = Release|Any CPU
521-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|x86.ActiveCfg = Release|Any CPU
522-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB}.Release|x86.Build.0 = Release|Any CPU
523509
{977060F4-EEEF-420D-02E8-5E58D3E51942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
524510
{977060F4-EEEF-420D-02E8-5E58D3E51942}.Debug|Any CPU.Build.0 = Debug|Any CPU
525511
{977060F4-EEEF-420D-02E8-5E58D3E51942}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -597,7 +583,6 @@ Global
597583
{0F27CF0C-4C95-DB17-AF84-78197F32FEBE} = {243A4561-BF35-405A-AF12-AC57BB27796D}
598584
{B95B12A8-FCE1-618A-CA77-134B59A5C050} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
599585
{261CB211-6023-8025-48E1-D11953F4C61C} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
600-
{89DF188B-B1FC-D3C4-A76E-019144ABA9CB} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
601586
{977060F4-EEEF-420D-02E8-5E58D3E51942} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
602587
{40B3EEE3-2B38-4264-A32F-173D129090F8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
603588
{9B43D741-AED1-42DA-88EA-19CB1D71C41C} = {1A456CF0-C09A-4DE6-89CE-1110EED31180}

src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ private async Task<string> GetFileContentsAsync(string owner, string repo, strin
130130

131131
return this.GetDecodedContent(content);
132132
}
133-
catch (HttpRequestException reqEx) when (reqEx.Message.Contains(((int)HttpStatusCode.NotFound).ToString()))
133+
catch (HttpRequestException e) when (e.StatusCode == HttpStatusCode.NotFound)
134134
{
135-
throw new DependencyFileNotFoundException(filePath, $"{owner}/{repo}", branch, reqEx);
135+
throw new DependencyFileNotFoundException(filePath, $"{owner}/{repo}", branch, e);
136136
}
137137
}
138138

@@ -176,7 +176,7 @@ public async Task CreateBranchAsync(string repoUri, string newBranch, string bas
176176

177177
_logger.LogInformation("Branch '{branch}' exists, updated", newBranch);
178178
}
179-
catch (HttpRequestException exc) when (exc.Message.Contains(((int)HttpStatusCode.NotFound).ToString()))
179+
catch (HttpRequestException e) when (e.StatusCode == HttpStatusCode.NotFound)
180180
{
181181
_logger.LogInformation("'{branch}' branch doesn't exist. Creating it...", newBranch);
182182

@@ -903,8 +903,8 @@ private HttpClient CreateHttpClient(string repoUri)
903903

904904
return content["sha"]!.ToString();
905905
}
906-
catch (HttpRequestException exc) when (exc.Message.Contains(((int)HttpStatusCode.NotFound).ToString())
907-
|| exc.Message.Contains(((int)HttpStatusCode.UnprocessableEntity).ToString()))
906+
catch (HttpRequestException e) when (e.StatusCode == HttpStatusCode.NotFound
907+
|| e.StatusCode == HttpStatusCode.UnprocessableEntity)
908908
{
909909
return null;
910910
}
@@ -1239,7 +1239,7 @@ public async Task<GitDiff> GitDiffAsync(string repoUri, string baseVersion, stri
12391239
Valid = true
12401240
};
12411241
}
1242-
catch (HttpRequestException reqEx) when (reqEx.Message.Contains(((int)HttpStatusCode.NotFound).ToString()))
1242+
catch (HttpRequestException e) when (e.StatusCode == HttpStatusCode.NotFound)
12431243
{
12441244
return GitDiff.UnknownDiff();
12451245
}

src/Microsoft.DotNet.Darc/DarcLib/Helpers/DependencyFileManager.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,22 @@ public async Task<SemanticVersion> ReadToolsDotnetVersionAsync(string repoUri, s
158158
return dotnetVersion;
159159
}
160160

161-
public async Task<XmlDocument> ReadNugetConfigAsync(string repoUri, string branch)
161+
public async Task<(string Name, XmlDocument Content)> ReadNugetConfigAsync(string repoUri, string branch)
162162
{
163-
return await ReadXmlFileAsync(VersionFiles.NugetConfig, repoUri, branch);
163+
foreach (var name in VersionFiles.NugetConfigNames)
164+
{
165+
try
166+
{
167+
return (name, await ReadXmlFileAsync(name, repoUri, branch));
168+
}
169+
catch (DependencyFileNotFoundException)
170+
{
171+
continue;
172+
}
173+
}
174+
175+
throw new DependencyFileNotFoundException(
176+
$"None of the {VersionFiles.NugetConfigNames.First()} variations were found in the repo '{repoUri}' and branch '{branch}'");
164177
}
165178

166179
public async Task<VersionDetails> ParseVersionDetailsXmlAsync(string repoUri, string branch, bool includePinned = true)
@@ -391,7 +404,7 @@ public async Task<GitFileContentContainer> UpdateDependencyFiles(
391404
XmlDocument versionProps = await ReadVersionPropsAsync(repoUri, branch);
392405
JObject globalJson = await ReadGlobalJsonAsync(repoUri, branch, repoIsVmr);
393406
JObject toolsConfigurationJson = await ReadDotNetToolsConfigJsonAsync(repoUri, branch, repoIsVmr);
394-
XmlDocument nugetConfig = await ReadNugetConfigAsync(repoUri, branch);
407+
(string nugetConfigName, XmlDocument nugetConfig) = await ReadNugetConfigAsync(repoUri, branch);
395408

396409
foreach (DependencyDetail itemToUpdate in itemsToUpdate)
397410
{
@@ -427,7 +440,7 @@ public async Task<GitFileContentContainer> UpdateDependencyFiles(
427440
// At this point we only care about the Maestro managed locations for the assets.
428441
// Flatten the dictionary into a set that has all the managed feeds
429442
Dictionary<string, HashSet<string>> managedFeeds = FlattenLocationsAndSplitIntoGroups(itemsToUpdateLocations);
430-
var updatedNugetConfig = UpdatePackageSources(nugetConfig, managedFeeds);
443+
nugetConfig = UpdatePackageSources(nugetConfig, managedFeeds);
431444

432445
// Update the dotnet sdk if necessary
433446
Dictionary<GitFileMetadataName, string> globalJsonMetadata = null;
@@ -441,7 +454,7 @@ public async Task<GitFileContentContainer> UpdateDependencyFiles(
441454
GlobalJson = new GitFile(VersionFiles.GlobalJson, globalJson, globalJsonMetadata),
442455
VersionDetailsXml = new GitFile(VersionFiles.VersionDetailsXml, versionDetails),
443456
VersionProps = new GitFile(VersionFiles.VersionProps, versionProps),
444-
NugetConfig = new GitFile(VersionFiles.NugetConfig, updatedNugetConfig)
457+
NugetConfig = new GitFile(nugetConfigName, nugetConfig),
445458
};
446459

447460
// dotnet-tools.json is optional, so only include it if it was found.

src/Microsoft.DotNet.Darc/DarcLib/Helpers/IDependencyFileManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public interface IDependencyFileManager
4040

4141
Task<JObject> ReadGlobalJsonAsync(string repoUri, string branch, bool repoIsVmr);
4242

43-
Task<XmlDocument> ReadNugetConfigAsync(string repoUri, string branch);
43+
Task<(string Name, XmlDocument Content)> ReadNugetConfigAsync(string repoUri, string branch);
4444

4545
Task<XmlDocument> ReadVersionDetailsXmlAsync(string repoUri, string branch);
4646

src/Microsoft.DotNet.Darc/DarcLib/Helpers/VersionFiles.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using NuGet.Versioning;
55
using System;
6+
using System.Collections.Generic;
67

78
namespace Microsoft.DotNet.DarcLib.Helpers;
89

@@ -16,7 +17,7 @@ public static class VersionFiles
1617
public const string VersionProps = "eng/Versions.props";
1718
public const string GlobalJson = "global.json";
1819
public const string DotnetToolsConfigJson = ".config/dotnet-tools.json";
19-
public const string NugetConfig = "NuGet.config";
20+
public static readonly IReadOnlyCollection<string> NugetConfigNames = ["NuGet.config", "nuget.config", "NuGet.Config"];
2021

2122
private static string GetVersionPropsElementBaseName(string dependencyName)
2223
{

src/Microsoft.DotNet.Darc/DarcLib/Remote.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ await _remoteGitClient.MergeDependencyPullRequestAsync(pullRequestUrl,
154154
public async Task<IEnumerable<string>> GetPackageSourcesAsync(string repoUri, string commit)
155155
{
156156
CheckForValidGitClient();
157-
XmlDocument nugetConfig = await _fileManager.ReadNugetConfigAsync(repoUri, commit);
157+
(_, XmlDocument nugetConfig) = await _fileManager.ReadNugetConfigAsync(repoUri, commit);
158158
return _fileManager.GetPackageSources(nugetConfig).Select(nameAndFeed => nameAndFeed.feed);
159159
}
160160

@@ -222,10 +222,11 @@ public async Task<List<GitFile>> CommitUpdatesAsync(
222222
{
223223
engCommonFiles = engCommonFiles
224224
.Select(f => new GitFile(
225-
f.FilePath.Replace(VmrInfo.ArcadeRepoDir, null).TrimStart('/'),
225+
f.FilePath.Replace(VmrInfo.ArcadeRepoDir, null, StringComparison.InvariantCultureIgnoreCase).TrimStart('/'),
226226
f.Content,
227227
f.ContentEncoding,
228-
f.Mode))
228+
f.Mode,
229+
f.Operation))
229230
.ToList();
230231
}
231232

@@ -239,7 +240,7 @@ public async Task<List<GitFile>> CommitUpdatesAsync(
239240

240241
foreach (GitFile file in targetEngCommonFiles)
241242
{
242-
if (!engCommonFiles.Where(f => f.FilePath == file.FilePath).Any())
243+
if (!engCommonFiles.Any(f => f.FilePath.Equals(file.FilePath, StringComparison.InvariantCultureIgnoreCase)))
243244
{
244245
deletedFiles.Add(file.FilePath);
245246
// This is a file in the repo's eng/common folder that isn't present in Arcade at the
@@ -258,10 +259,16 @@ public async Task<List<GitFile>> CommitUpdatesAsync(
258259

259260
if (deletedFiles.Count > 0)
260261
{
261-
_logger.LogInformation($"Dependency update from Arcade commit {arcadeItem.Commit} to {repoUri} " +
262-
$"on branch {branch}@{latestCommit} will delete files in eng/common." +
263-
$" Source file count: {engCommonFiles.Count}, Target file count: {targetEngCommonFiles.Count}." +
264-
$" Deleted files: {string.Join(Environment.NewLine, deletedFiles)}");
262+
_logger.LogInformation(
263+
"Dependency update from Arcade commit {commit} to {repoUri} on branch {branch}@{latestCommit} will delete files in eng/common. " +
264+
"Source file count: {sourceFileCount}, Target file count: {targetFileCount}. Deleted files: {deletedFiles}",
265+
arcadeItem.Commit,
266+
repoUri,
267+
branch,
268+
latestCommit,
269+
engCommonFiles.Count,
270+
targetEngCommonFiles.Count,
271+
string.Join(Environment.NewLine, deletedFiles));
265272
}
266273
}
267274

src/Microsoft.DotNet.Darc/DarcLib/RemoteRepoBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private async Task<string> SparseAndShallowCheckoutAsync(
172172
await ExecuteGitCommand(["config", "user.name", user], workingDirectory);
173173
await ExecuteGitCommand(["config", "user.email", email], workingDirectory);
174174

175-
File.WriteAllLines(Path.Combine(workingDirectory, ".git/info/sparse-checkout"), ["eng/", ".config/", $"/{VersionFiles.NugetConfig}", $"/{VersionFiles.GlobalJson}"]);
175+
File.WriteAllLines(Path.Combine(workingDirectory, ".git/info/sparse-checkout"), ["eng/", ".config/", $"/{VersionFiles.NugetConfigNames.First()}", $"/{VersionFiles.GlobalJson}"]);
176176

177177
await ExecuteGitCommand([$"-c", "core.askpass=", "-c", "credential.helper=", "pull", "--depth=1", remote, branch], workingDirectory, secretToMask: pat);
178178
await ExecuteGitCommand([$"checkout", branch], workingDirectory);

src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using LibGit2Sharp;
1010
using Microsoft.DotNet.DarcLib.Helpers;
1111
using Microsoft.DotNet.DarcLib.Models;
12-
using Microsoft.DotNet.DarcLib.Models.Darc;
1312
using Microsoft.DotNet.DarcLib.Models.VirtualMonoRepo;
1413
using Microsoft.DotNet.ProductConstructionService.Client.Models;
1514
using Microsoft.Extensions.Logging;
@@ -410,18 +409,26 @@ await _repositoryCloneManager.PrepareCloneAsync(
410409
}
411410
}
412411

413-
private IReadOnlyCollection<string> GetPatchExclusions(SourceMapping mapping) =>
412+
private IReadOnlyCollection<string> GetPatchExclusions(SourceMapping mapping)
413+
{
414414
// Exclude all submodules that belong to the mapping
415-
[.._sourceManifest.Submodules
415+
var exclusions = _sourceManifest.Submodules
416416
.Where(s => s.Path.StartsWith(mapping.Name + '/'))
417-
.Select(s => s.Path.Substring(mapping.Name.Length + 1))
417+
.Select(s => s.Path.Substring(mapping.Name.Length + 1));
418418

419419
// Exclude version files as those will be handled manually
420-
.Concat(DependencyFileManager.DependencyFiles)
420+
exclusions = exclusions
421+
.Concat(DependencyFileManager.DependencyFiles);
421422

422-
// Exclude eng/common as that will be copied based on the arcade version
423-
.Append(Constants.CommonScriptFilesPath)
424-
.Select(VmrPatchHandler.GetExclusionRule)];
423+
// Exclude eng/common for non-arcade mappings (it will be copied separately based on the Arcade.Sdk package version)
424+
if (mapping.Name != "arcade")
425+
{
426+
exclusions = exclusions
427+
.Append(Constants.CommonScriptFilesPath);
428+
}
429+
430+
return [.. exclusions.Select(VmrPatchHandler.GetExclusionRule)];
431+
}
425432

426433
private async Task RecreatePreviousFlowAndApplyBuild(
427434
SourceMapping mapping,

src/ProductConstructionService/ProductConstructionService.DependencyFlow/PcsVmrBackFlower.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ await _vmrCloneManager.PrepareVmrAsync(
115115

116116
// Prepare repo
117117
SourceMapping mapping = _dependencyTracker.GetMapping(subscription.SourceDirectory);
118-
var remotes = new[] { mapping.DefaultRemote, _sourceManifest.GetRepoVersion(mapping.Name).RemoteUri }
118+
var remotes = new[]
119+
{
120+
mapping.DefaultRemote,
121+
_sourceManifest.GetRepoVersion(mapping.Name).RemoteUri,
122+
subscription.TargetRepository
123+
}
119124
.Distinct()
120125
.OrderRemotesByLocalPublicOther()
121126
.ToList();

test/Microsoft.DotNet.Darc.Tests/DependencyCoherencyTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ private void RepositoryHasFeeds(string repo, string commit, string[] feeds)
12451245
string.Join(Environment.NewLine, feeds.Select(feed => $@"<add key = ""{GetRandomId()}"" value = ""{feed}"" />")));
12461246

12471247
_gitRepoMock
1248-
.Setup(m => m.GetFileContentsAsync(VersionFiles.NugetConfig, repo, commit))
1248+
.Setup(m => m.GetFileContentsAsync(VersionFiles.NugetConfigNames.First(), repo, commit))
12491249
.ReturnsAsync(nugetConfig);
12501250
}
12511251

0 commit comments

Comments
 (0)