Skip to content

Commit 59b5100

Browse files
[nightly] Update dependencies from chisel
1 parent e73b356 commit 59b5100

File tree

28 files changed

+196
-76
lines changed

28 files changed

+196
-76
lines changed

eng/update-dependencies/BaseUrlUpdater.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Data;
67
using System.Diagnostics;
78
using System.Linq;
89
using Microsoft.DotNet.VersionTools.Dependencies;
@@ -25,28 +26,41 @@ internal class BaseUrlUpdater : FileRegexUpdater
2526
/// If the base URL variable cannot be found in the manifest, the updater
2627
/// won't do anything.
2728
/// </summary>
28-
public static IDependencyUpdater Create(ManifestVariables manifestVariables, SpecificCommandOptions options)
29+
public static IEnumerable<IDependencyUpdater> CreateUpdaters(ManifestVariables manifestVariables, SpecificCommandOptions options)
2930
{
3031
if (manifestVariables is null)
3132
{
3233
Trace.TraceWarning("BaseUrlUpdater: manifest variables missing - skipping base URL update.");
33-
return new EmptyDependencyUpdater();
34+
return [];
3435
}
3536

3637
var upstreamBranch = manifestVariables.GetValue("branch");
37-
string baseUrlVarName = ManifestHelper.GetBaseUrlVariableName(
38+
var baseUrlVarNames = ManifestHelper.GetBaseUrlVariableNames(
3839
dockerfileVersion: options.DockerfileVersion,
3940
branch: upstreamBranch,
4041
versionSourceName: options.VersionSourceName,
4142
sdkOnlyRelease: options.IsSdkOnly);
4243

43-
if (!manifestVariables.HasValue(baseUrlVarName))
44+
IEnumerable<IDependencyUpdater> updaters = baseUrlVarNames
45+
.SelectMany(variable => CreateUpdater(variable, manifestVariables, options));
46+
47+
return updaters;
48+
}
49+
50+
private static IEnumerable<IDependencyUpdater> CreateUpdater(
51+
string baseUrlVarName,
52+
ManifestVariables manifestVariables,
53+
SpecificCommandOptions options)
54+
{
55+
var variableHasValue = manifestVariables.HasValue(baseUrlVarName);
56+
57+
if (!variableHasValue)
4458
{
4559
Trace.TraceWarning($"BaseUrlUpdater: variable '{baseUrlVarName}' not found - skipping base URL update.");
46-
return new EmptyDependencyUpdater();
60+
return [];
4761
}
4862

49-
return new BaseUrlUpdater(options, manifestVariables, baseUrlVarName);
63+
return [new BaseUrlUpdater(options, manifestVariables, baseUrlVarName)];
5064
}
5165

5266
private BaseUrlUpdater(

eng/update-dependencies/DockerfileShaUpdater.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static IEnumerable<IDependencyUpdater> CreateUpdaters(
137137
{
138138
usedBuildInfos = [dependencyBuildInfos.First(info => info.SimpleName == _productName)];
139139

140-
string baseUrl = ManifestHelper.GetBaseUrl(_manifestVariables.Variables, _options);
140+
string baseUrl = ManifestHelper.GetBaseUrls(_manifestVariables.Variables, _options).First();
141141
// Remove Aspire Dashboard case once https://github.com/dotnet/aspire/issues/2035 is fixed.
142142
string archiveExt = _os.Contains("win") || _productName.Contains("aspire-dashboard") ? "zip" : "tar.gz";
143143
string versionDir = _buildVersion ?? "";
@@ -275,8 +275,12 @@ private static string GetArch(string[] variableParts)
275275
// corresponding build in the daily build location, for example, will not be signed due. So when we're targeting
276276
// the daily build location, we wouldn't use the release checksums file and instead use the other means of
277277
// retrieving the checksums.
278-
string baseUrl = ManifestHelper.GetBaseUrl(_manifestVariables.Variables, _options);
279-
if (baseUrl != ReleaseDotnetBaseCdnUrl)
278+
string? baseUrl = ManifestHelper
279+
.GetBaseUrls(_manifestVariables.Variables, _options)
280+
.Where(url => url == ReleaseDotnetBaseCdnUrl)
281+
.FirstOrDefault();
282+
283+
if (string.IsNullOrWhiteSpace(baseUrl))
280284
{
281285
return null;
282286
}

eng/update-dependencies/FromStagingPipelineCommand.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Dotnet.Docker.Git;
55
using Dotnet.Docker.Sync;
6+
using Microsoft.DotNet.Docker.Shared;
67
using Microsoft.Extensions.Logging;
78

89
namespace Dotnet.Docker;
@@ -66,12 +67,13 @@ public override async Task<int> ExecuteAsync(FromStagingPipelineOptions options)
6667
options.StagingPipelineRunId);
6768

6869
string dotnetProductVersion = VersionHelper.ResolveProductVersion(releaseConfig.RuntimeBuild);
69-
string dockerfileVersion = VersionHelper.ResolveMajorMinorVersion(releaseConfig.RuntimeBuild).ToString();
70+
DotNetVersion dotNetVersion = DotNetVersion.Parse(releaseConfig.RuntimeBuild);
71+
string majorMinorVersionString = dotNetVersion.ToString(2);
7072

71-
// Record pipeline run ID for this dockerfileVersion, for later use by sync-internal-release command
73+
// Record pipeline run ID for this internal version, for later use by sync-internal-release command
7274
_internalVersionsService.RecordInternalStagingBuild(
7375
repoRoot: gitRepoContext.LocalRepoPath,
74-
dockerfileVersion: dockerfileVersion,
76+
dotNetVersion: dotNetVersion,
7577
stagingPipelineRunId: options.StagingPipelineRunId);
7678

7779
var productVersions = (options.Internal, releaseConfig.SdkOnly) switch
@@ -130,7 +132,7 @@ public override async Task<int> ExecuteAsync(FromStagingPipelineOptions options)
130132
var updateDependenciesOptions = new SpecificCommandOptions()
131133
{
132134
RepoRoot = gitRepoContext.LocalRepoPath,
133-
DockerfileVersion = dockerfileVersion.ToString(),
135+
DockerfileVersion = majorMinorVersionString,
134136
ProductVersions = productVersions,
135137
InternalBaseUrl = internalBaseUrl,
136138
};
@@ -144,10 +146,10 @@ public override async Task<int> ExecuteAsync(FromStagingPipelineOptions options)
144146
return exitCode;
145147
}
146148

147-
var commitMessage = $"Update .NET {dockerfileVersion} to {productVersions["sdk"]} SDK / {productVersions["runtime"]} Runtime";
149+
var commitMessage = $"Update .NET {majorMinorVersionString} to {productVersions["sdk"]} SDK / {productVersions["runtime"]} Runtime";
148150
var prTitle = $"[{options.TargetBranch}] {commitMessage}";
149151
var prBody = $"""
150-
This pull request updates .NET {dockerfileVersion} to the following versions:
152+
This pull request updates .NET {majorMinorVersionString} to the following versions:
151153
152154
- SDK: {productVersions["sdk"]}
153155
- Runtime: {productVersions["runtime"]}

eng/update-dependencies/ManifestHelper.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,30 @@ public static partial class ManifestHelper
1515
private const string VariablePattern = $"\\$\\((?<{VariableGroupName}>[\\w:\\-.|]+)\\)";
1616

1717
/// <summary>
18-
/// Gets the base URL based on the configured context.
18+
/// Gets the base URLs based on the configured context.
1919
/// </summary>
2020
/// <param name="manifestVariables">JSON object of the variables from the manifest.</param>
2121
/// <param name="options">Configured options from the app.</param>
22-
public static string GetBaseUrl(JObject manifestVariables, SpecificCommandOptions options)
22+
public static IEnumerable<string> GetBaseUrls(JObject manifestVariables, SpecificCommandOptions options)
2323
{
2424
// The upstream branch represents which GitHub branch the current
2525
// branch branched off of. This is either "nightly" or "main".
2626
var upstreamBranch = ResolveVariableValue("branch", manifestVariables);
2727

28-
var baseUrlVariableName = GetBaseUrlVariableName(
28+
var baseUrlVariableNames = GetBaseUrlVariableNames(
2929
dockerfileVersion: options.DockerfileVersion,
3030
branch: upstreamBranch,
3131
versionSourceName: options.VersionSourceName);
3232

33-
return ResolveVariableValue(baseUrlVariableName, manifestVariables);
33+
var baseUrlValues = baseUrlVariableNames
34+
.Select(variable => ResolveVariableValue(variable, manifestVariables));
35+
36+
return baseUrlValues;
3437
}
3538

3639
/// <summary>
37-
/// Constructs the name of the product version base URL variable.
40+
/// Constructs the base URL variables for the given dockerfile, branch,
41+
/// and product combination.
3842
/// </summary>
3943
/// <param name="dockerfileVersion">
4044
/// Dockerfile version. This should be a major.minor version e.g. "8.0",
@@ -43,12 +47,11 @@ public static string GetBaseUrl(JObject manifestVariables, SpecificCommandOption
4347
/// <param name="branch">
4448
/// Name of the branch. This is typically "main" or "nightly".
4549
/// </param>
46-
public static string GetBaseUrlVariableName(
50+
public static IEnumerable<string> GetBaseUrlVariableNames(
4751
string dockerfileVersion,
4852
string branch,
4953
string versionSourceName = "",
50-
bool sdkOnlyRelease = false
51-
)
54+
bool sdkOnlyRelease = false)
5255
{
5356
string product;
5457
if (sdkOnlyRelease)
@@ -65,7 +68,10 @@ string v when v.Contains("aspire-dashboard") => "aspire-dashboard",
6568
};
6669
}
6770

68-
return $"{product}|{dockerfileVersion}|base-url|{branch}";
71+
return [
72+
$"{product}|{dockerfileVersion}|base-url|{branch}",
73+
$"{product}|{dockerfileVersion}|base-url|checksums|{branch}",
74+
];
6975
}
7076

7177
/// <summary>

eng/update-dependencies/SpecificCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private static IEnumerable<IDependencyUpdater> GetProductUpdaters(ManifestVariab
423423
List<IDependencyUpdater> updaters =
424424
[
425425
new NuGetConfigUpdater(manifestVariables, Options),
426-
BaseUrlUpdater.Create(manifestVariables, Options)
426+
..BaseUrlUpdater.CreateUpdaters(manifestVariables, Options)
427427
];
428428

429429
foreach (string productName in Options.ProductVersions.Keys)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.Docker.Shared;
5+
using NuGet.Versioning;
6+
7+
namespace Dotnet.Docker.Sync;
8+
9+
/// <summary>
10+
/// <see cref="DotNetVersion"/> Extensions that are only used for release branch synchronization.
11+
/// </summary>
12+
internal static class DotNetVersionExtensions
13+
{
14+
/// <summary>
15+
/// Converts a <see cref="DotNetVersion"/> to a new <see cref="DotNetVersion"/>
16+
/// with only the major and minor version parts.
17+
/// </summary>
18+
public static DotNetVersion ToMajorMinorVersion(this DotNetVersion version) =>
19+
new DotNetVersion(new SemanticVersion(version.Major, version.Minor, 0));
20+
}

eng/update-dependencies/Sync/IInternalVersionsService.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using Microsoft.DotNet.Docker.Shared;
5+
46
namespace Dotnet.Docker.Sync;
57

68
/// <summary>
@@ -18,13 +20,13 @@ internal interface IInternalVersionsService
1820
/// Records a staging pipeline run ID in the repo.
1921
/// </summary>
2022
/// <remarks>
21-
/// This will only store one staging pipeline run ID per dockerfileVersion.
23+
/// This will only store one staging pipeline run ID per <paramref name="dotNetVersion"/>.
2224
/// If a version already exists for the same dockerfileVersion, it will be
2325
/// overwritten.
2426
/// </remarks>
25-
/// <param name="dockerfileVersion">major-minor version</param>
27+
/// <param name="dotNetVersion">.NET build or product version</param>
2628
/// <param name="stagingPipelineRunId">the build ID of the staging pipeline run</param>
27-
void RecordInternalStagingBuild(string repoRoot, string dockerfileVersion, int stagingPipelineRunId);
29+
void RecordInternalStagingBuild(string repoRoot, DotNetVersion dotNetVersion, int stagingPipelineRunId);
2830

2931
/// <summary>
3032
/// Gets any previously recorded internal staging builds in the repo.

eng/update-dependencies/Sync/InternalStagingBuilds.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Immutable;
5+
using Microsoft.DotNet.Docker.Shared;
56

67
namespace Dotnet.Docker.Sync;
78

@@ -12,7 +13,7 @@ namespace Dotnet.Docker.Sync;
1213
/// <param name="Versions">
1314
/// Mapping of Major.Minor .NET version to staging pipeline run ID.
1415
/// </param>
15-
internal sealed record InternalStagingBuilds(ImmutableDictionary<string, int> Versions)
16+
internal sealed record InternalStagingBuilds(ImmutableDictionary<DotNetVersion, int> Versions)
1617
{
1718
/// <summary>
1819
/// Parses <see cref=" InternalStagingBuilds"/> from lines of text.
@@ -25,7 +26,11 @@ public static InternalStagingBuilds Parse(IEnumerable<string> lines)
2526
var versions = lines
2627
.Select(line => line.Split('=', 2))
2728
.Where(parts => parts.Length == 2)
28-
.ToImmutableDictionary(parts => parts[0], parts => int.Parse(parts[1]));
29+
.ToImmutableDictionary(
30+
// Reduce the version to major.minor only.
31+
// If we don't, we could end up with multiple entries for the same version.
32+
parts => DotNetVersion.Parse(parts[0]).ToMajorMinorVersion(),
33+
parts => int.Parse(parts[1]));
2934

3035
return new InternalStagingBuilds(versions);
3136
}
@@ -34,9 +39,14 @@ public static InternalStagingBuilds Parse(IEnumerable<string> lines)
3439
/// Returns a new <see cref="InternalStagingBuilds"/> with the specified
3540
/// version added.
3641
/// </summary>
37-
public InternalStagingBuilds Add(string dockerfileVersion, int stagingPipelineRunId) =>
38-
this with { Versions = Versions.SetItem(dockerfileVersion, stagingPipelineRunId) };
42+
public InternalStagingBuilds Add(DotNetVersion dotNetVersion, int stagingPipelineRunId) =>
43+
this with { Versions = Versions.SetItem(dotNetVersion.ToMajorMinorVersion(), stagingPipelineRunId) };
3944

45+
// Internal versions file should have one line per dockerfileVersion, and
46+
// each line should be formatted as: <dockerfileVersion>=<stagingPipelineRunId>
4047
public override string ToString() =>
41-
string.Join(Environment.NewLine, Versions.Select(kv => $"{kv.Key}={kv.Value}"));
48+
string.Join(Environment.NewLine,
49+
Versions
50+
.OrderBy(kv => kv.Key)
51+
.Select(kv => $"{kv.Key.ToString(2)}={kv.Value}"));
4252
}

eng/update-dependencies/Sync/InternalVersionsService.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Immutable;
5+
using Microsoft.DotNet.Docker.Shared;
56

67
namespace Dotnet.Docker.Sync;
78

@@ -21,12 +22,12 @@ public InternalStagingBuilds GetInternalStagingBuilds(string repoRoot)
2122
}
2223
catch (FileNotFoundException)
2324
{
24-
return new InternalStagingBuilds(ImmutableDictionary<string, int>.Empty);
25+
return new InternalStagingBuilds(ImmutableDictionary<DotNetVersion, int>.Empty);
2526
}
2627
}
2728

2829
/// <inheritdoc/>
29-
public void RecordInternalStagingBuild(string repoRoot, string dockerfileVersion, int stagingPipelineRunId)
30+
public void RecordInternalStagingBuild(string repoRoot, DotNetVersion dotNetVersion, int stagingPipelineRunId)
3031
{
3132
// Internal versions file should have one line per dockerfileVersion
3233
// Each line should be formatted as: <dockerfileVersion>=<stagingPipelineRunId>
@@ -38,10 +39,7 @@ public void RecordInternalStagingBuild(string repoRoot, string dockerfileVersion
3839
// 2) lots of regex JSON manipulation which is error-prone and harder to maintain
3940
//
4041
// So for now, the separate file and format is a compromise.
41-
42-
// Internal versions file should have one line per dockerfileVersion
43-
// Each line should be formatted as: <dockerfileVersion>=<stagingPipelineRunId>
44-
var builds = GetInternalStagingBuilds(repoRoot).Add(dockerfileVersion, stagingPipelineRunId);
42+
var builds = GetInternalStagingBuilds(repoRoot).Add(dotNetVersion, stagingPipelineRunId);
4543
var internalVersionFile = Path.Combine(repoRoot, InternalVersionsFileName);
4644
File.WriteAllText(internalVersionFile, builds.ToString());
4745
}

manifest.versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
"libssl|jammy": "3",
101101
"libssl|noble": "3t64",
102102

103-
"mingit|latest|x64|url": "https://github.com/git-for-windows/git/releases/download/v2.51.1.windows.1/MinGit-2.51.1-64-bit.zip",
104-
"mingit|latest|x64|sha": "ce0360b2bfcb60472064de698c8a5b73e63067320701fcd51d30a6e33d7967fa",
103+
"mingit|latest|x64|url": "https://github.com/git-for-windows/git/releases/download/v2.51.2.windows.1/MinGit-2.51.2-64-bit.zip",
104+
"mingit|latest|x64|sha": "8f0a7bc389c0bccc9daf6107cff4efb176348e34b8d787f02a36679a5588e072",
105105
"mingit|8.0|x64|url": "$(mingit|latest|x64|url)",
106106
"mingit|8.0|x64|sha": "$(mingit|latest|x64|sha)",
107107
"mingit|9.0|x64|url": "$(mingit|latest|x64|url)",

0 commit comments

Comments
 (0)