WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit d8d25dc

Browse files
authored
[Rollout] Production rollout 2025-02-25 (#4490)
#4489
2 parents 3c92af9 + 410e94a commit d8d25dc

File tree

27 files changed

+331
-306
lines changed

27 files changed

+331
-306
lines changed

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@
9797
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
9898
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="8.0.0" />
9999
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.1" />
100-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
100+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
101101
<PackageVersion Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.22.0" />
102102
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
103103
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
104104
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
105105
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" />
106-
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.10.4" />
107-
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.10.4" />
106+
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.11.4" />
107+
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.11.4" />
108108
<PackageVersion Include="Microsoft.Identity.Web" Version="2.18.2" />
109109
<PackageVersion Include="Microsoft.TeamFoundationServer.Client" Version="19.232.0-preview" />
110110
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />

src/Microsoft.DotNet.Darc/Darc/Helpers/UxHelpers.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,6 @@ public static string GetSubscriptionDescription(Subscription subscription)
7979
return $"{subscription.SourceRepository} ({subscription.Channel.Name}) ==> '{subscription.TargetRepository}' ('{subscription.TargetBranch}')";
8080
}
8181

82-
/// <summary>
83-
/// Get a link to the build in AzDO, or null if it cannot be constructed.
84-
/// </summary>
85-
/// <param name="build">Build</param>
86-
/// <returns>Link to the build in AzDO</returns>
87-
private static string GetBuildLink(Build build)
88-
{
89-
if (!string.IsNullOrEmpty(build.AzureDevOpsAccount) &&
90-
!string.IsNullOrEmpty(build.AzureDevOpsProject) &&
91-
build.AzureDevOpsBuildId.HasValue)
92-
{
93-
return $"https://dev.azure.com/{build.AzureDevOpsAccount}/{build.AzureDevOpsProject}/_build/results?buildId={build.AzureDevOpsBuildId.Value}";
94-
}
95-
return null;
96-
}
97-
9882
/// <summary>
9983
/// Get the build description as a JObject.
10084
/// </summary>
@@ -110,7 +94,7 @@ public static JObject GetJsonBuildDescription(Build build)
11094
commit = build.Commit,
11195
buildNumber = build.AzureDevOpsBuildNumber,
11296
dateProduced = build.DateProduced.ToLocalTime().ToString("g"),
113-
buildLink = GetBuildLink(build),
97+
buildLink = build.GetBuildLink(),
11498
azdoBuildId = build.AzureDevOpsBuildId,
11599
released = build.Released,
116100
channels = build.Channels.Select(channel => channel.Name)
@@ -130,7 +114,7 @@ public static string GetTextBuildDescription(Build build)
130114
builder.AppendLine($"Commit: {build.Commit}");
131115
builder.AppendLine($"Build Number: {build.AzureDevOpsBuildNumber}");
132116
builder.AppendLine($"Date Produced: {build.DateProduced.ToLocalTime().ToString("g")}");
133-
builder.AppendLine($"Build Link: {GetBuildLink(build) ?? "N/A"}");
117+
builder.AppendLine($"Build Link: {build.GetBuildLink() ?? "N/A"}");
134118
builder.AppendLine($"AzDO Build Id: {build.AzureDevOpsBuildId}");
135119
builder.AppendLine($"BAR Build Id: {build.Id}");
136120
builder.AppendLine($"Released: {build.Released}");

src/Microsoft.DotNet.Darc/Darc/Operations/VirtualMonoRepo/ForwardFlowOperation.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.DotNet.DarcLib.Helpers;
1010
using Microsoft.DotNet.DarcLib.VirtualMonoRepo;
1111
using Microsoft.Extensions.Logging;
12+
using Microsoft.DotNet.DarcLib.Models.VirtualMonoRepo;
1213

1314
#nullable enable
1415
namespace Microsoft.DotNet.Darc.Operations.VirtualMonoRepo;
@@ -34,7 +35,7 @@ protected override async Task<bool> FlowAsync(
3435
var build = await basicBarClient.GetBuildAsync(_options.Build
3536
?? throw new ArgumentException("Please specify a build to flow"));
3637

37-
return await vmrForwardFlower.FlowForwardAsync(
38+
CodeFlowResult codeFlowRes = await vmrForwardFlower.FlowForwardAsync(
3839
mappingName,
3940
repoPath,
4041
build,
@@ -44,5 +45,6 @@ await GetTargetBranch(repoPath),
4445
_vmrInfo.VmrPath,
4546
_options.DiscardPatches,
4647
cancellationToken: cancellationToken);
48+
return codeFlowRes.hadUpdates;
4749
}
4850
}

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
using LibGit2Sharp;
1212
using Maestro.Common;
1313
using Microsoft.DotNet.DarcLib.Helpers;
14+
using Microsoft.DotNet.Services.Utility;
1415
using Microsoft.Extensions.Logging;
16+
using Microsoft.Extensions.Options;
1517

1618
#nullable enable
1719
namespace Microsoft.DotNet.DarcLib;
@@ -23,6 +25,7 @@ public class LocalLibGit2Client : LocalGitClient, ILocalLibGit2Client
2325
{
2426
private readonly IRemoteTokenProvider _remoteTokenProvider;
2527
private readonly IProcessManager _processManager;
28+
private readonly ExponentialRetry _exponentialRetry;
2629
private readonly ILogger _logger;
2730

2831
public LocalLibGit2Client(
@@ -35,13 +38,17 @@ public LocalLibGit2Client(
3538
{
3639
_remoteTokenProvider = remoteTokenProvider;
3740
_processManager = processManager;
41+
_exponentialRetry = new ExponentialRetry(Options.Create(new ExponentialRetryOptions
42+
{
43+
RetryCount = 3,
44+
RetryBackOffFactor = 1.3,
45+
}));
3846
_logger = logger;
3947
}
4048

4149
public async Task CommitFilesAsync(List<GitFile> filesToCommit, string repoPath, string branch, string commitMessage)
4250
{
4351
repoPath = await GetRootDirAsync(repoPath);
44-
4552
try
4653
{
4754
using (var localRepo = new Repository(repoPath))
@@ -358,7 +365,14 @@ public async Task Push(
358365
}
359366
};
360367

361-
repo.Network.Push(remote, branch.CanonicalName, pushOptions);
368+
await _exponentialRetry.RetryAsync(
369+
() =>
370+
{
371+
repo.Network.Push(remote, branch.CanonicalName, pushOptions);
372+
return Task.CompletedTask;
373+
},
374+
ex => _logger.LogWarning(ex, "An exception occurred during `git push`: {exceptionMessage}. Retrying...", ex.Message),
375+
ex => ex is LibGit2SharpException);
362376
repo.Branches.Update(branch, b => b.TrackedBranch = $"refs/remotes/{remote.Name}/{branch.FriendlyName}");
363377

364378
_logger.LogInformation("Pushed branch {branch} to {remote}", branch, remote.Url);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Microsoft.DotNet.DarcLib.Helpers;
5+
6+
namespace Microsoft.DotNet.DarcLib.Models.VirtualMonoRepo;
7+
8+
public record CodeFlowResult(
9+
bool hadUpdates,
10+
NativePath repoPath,
11+
string previousFlowRepoSha,
12+
string previousFlowVmrSha);

src/Microsoft.DotNet.Darc/DarcLib/Models/VirtualMonoRepo/SourceMappingFile.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public class SourceMappingFile
3636
/// </summary>
3737
public string? SourceMappingsPath { get; set; }
3838

39+
/// <summary>
40+
/// Location within the VMR where the third-party notices template file is stored
41+
/// </summary>
42+
public string? ThirdPartyNoticesTemplatePath { get; set; }
43+
3944
/// <summary>
4045
/// Each of these mappings has a corresponding folder in the src/ directory
4146
/// </summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ await UpdateRepoToRevisionAsync(
149149
currentVersion.Sha,
150150
commitMessage,
151151
restoreVmrPatches: false,
152-
tpnTemplatePath: _vmrInfo.VmrPath / VmrInfo.ThirdPartyNoticesTemplatePath,
152+
tpnTemplatePath: _vmrInfo.ThirdPartyNoticesTemplateFullPath,
153153
generateCodeowners: true,
154154
generateCredScanSuppressions: true,
155155
discardPatches: true,

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface IPcsVmrBackFlower : IVmrBackFlower
3030
/// Boolean whether there were any changes to be flown
3131
/// and a path to the local repo where the new branch is created
3232
/// </returns>
33-
Task<(bool HadUpdates, NativePath RepoPath)> FlowBackAsync(
33+
Task<CodeFlowResult> FlowBackAsync(
3434
Subscription subscription,
3535
Build build,
3636
string targetBranch,
@@ -69,7 +69,7 @@ public PcsVmrBackFlower(
6969
_repositoryCloneManager = repositoryCloneManager;
7070
}
7171

72-
public async Task<(bool HadUpdates, NativePath RepoPath)> FlowBackAsync(
72+
public async Task<CodeFlowResult> FlowBackAsync(
7373
Subscription subscription,
7474
Build build,
7575
string targetBranch,
@@ -95,7 +95,11 @@ public PcsVmrBackFlower(
9595
headBranchExisted,
9696
cancellationToken);
9797

98-
return (hadUpdates, targetRepo.Path);
98+
return new CodeFlowResult(
99+
hadUpdates,
100+
targetRepo.Path,
101+
lastFlow.RepoSha,
102+
lastFlow.VmrSha);
99103
}
100104

101105
private async Task<(bool, SourceMapping, ILocalGitRepo)> PrepareVmrAndRepo(

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public interface IPcsVmrForwardFlower
2525
/// <param name="subscription">Subscription to flow</param>
2626
/// <param name="build">Build to flow</param>
2727
/// <param name="targetBranch">Target branch to make the changes on</param>
28-
/// <returns>True when there were changes to be flown</returns>
29-
Task<bool> FlowForwardAsync(
28+
Task<CodeFlowResult> FlowForwardAsync(
3029
Subscription subscription,
3130
Build build,
3231
string headBranch,
@@ -59,7 +58,7 @@ public PcsVmrForwardFlower(
5958
_repositoryCloneManager = repositoryCloneManager;
6059
}
6160

62-
public async Task<bool> FlowForwardAsync(
61+
public async Task<CodeFlowResult> FlowForwardAsync(
6362
Subscription subscription,
6463
Build build,
6564
string headBranch,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public async Task<IReadOnlyCollection<SourceMapping>> ParseMappings(string mappi
5656

5757
_vmrInfo.PatchesPath = NormalizePath(settings.PatchesPath);
5858
_vmrInfo.SourceMappingsPath = settings.SourceMappingsPath;
59+
_vmrInfo.ThirdPartyNoticesTemplatePath = settings.ThirdPartyNoticesTemplatePath;
5960

6061
if (settings.AdditionalMappings is not null)
6162
{

0 commit comments

Comments
 (0)