Skip to content

Commit 95708cd

Browse files
committed
Specify expected Alpine floating tag version in versions manifest file
1 parent 6daa323 commit 95708cd

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

manifest.versions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"base-url|public|preview|main": "$(base-url|public|maintenance|main)",
66
"base-url|public|preview|nightly": "https://dotnetbuilds.azureedge.net/public",
77

8+
"alpine|9.0|floating-tag-version": "alpine3.20",
9+
"alpine|8.0|floating-tag-version": "alpine3.20",
10+
811
"aspire-dashboard|9.0|build-version": "9.0.1-preview.1.24557.2",
912
"aspire-dashboard|9.0|product-version": "9.0.1-preview.1",
1013
"aspire-dashboard|9.0|fixed-tag": "$(aspire-dashboard|9.0|product-version)",

tests/Microsoft.DotNet.Docker.Tests/StaticTagTests.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Xunit;
1313

1414
using static Microsoft.DotNet.Docker.Tests.ManifestHelper;
15+
using Microsoft.CodeAnalysis.CSharp.Syntax;
1516

1617
#nullable enable
1718

@@ -163,31 +164,17 @@ public void PlatformTag_TagExists(
163164
[MemberData(nameof(GetTagTestObjects), TestType.FloatingAlpine)]
164165
public void FloatingAlpineTag_OnLatestVersion(Repo repo, VersionType versionType, bool checkArchitecture)
165166
{
166-
Dictionary<DockerfileInfo, List<string>> dockerfileTags = GetDockerfileTags(repo);
167-
168167
IEnumerable<KeyValuePair<DockerfileInfo, List<string>>> alpineDockerfileTags =
169-
dockerfileTags.Where(p => p.Key.Os.Contains(OS.Alpine));
170-
171-
Version? latestAlpineVersion = alpineDockerfileTags
172-
.Select(kvp => kvp.Key)
173-
.Select(GetAlpineVersion)
174-
.OrderByDescending(version => version)
175-
.FirstOrDefault();
176-
177-
if (latestAlpineVersion is null)
178-
{
179-
// The repo doesn't have any alpine dockerfiles
180-
return;
181-
}
182-
183-
string latestAlpineOsVersion = OS.Alpine + latestAlpineVersion;
168+
GetDockerfileTags(repo)
169+
.Where(p => p.Key.Os.Contains(OS.Alpine));
184170

185171
using (new AssertionScope())
186172
{
187173
foreach ((DockerfileInfo dockerfileInfo, List<string> tags) in alpineDockerfileTags)
188174
{
175+
string alpineFloatingTagVersion = GetAlpineFloatingTagVersion(dockerfileInfo);
189176
Regex pattern = GetFloatingTagRegex(dockerfileInfo);
190-
if (dockerfileInfo.Os == latestAlpineOsVersion)
177+
if (dockerfileInfo.Os == alpineFloatingTagVersion)
191178
{
192179
tags.Should().ContainSingle(tag => pattern.IsMatch(tag),
193180
because: $"image {dockerfileInfo} should have an {OS.Alpine} floating tag");
@@ -200,6 +187,9 @@ public void FloatingAlpineTag_OnLatestVersion(Repo repo, VersionType versionType
200187
}
201188
}
202189

190+
string GetAlpineFloatingTagVersion(DockerfileInfo info) =>
191+
Config.GetVariableValue($"alpine|{info.MajorMinor}|floating-tag-version");
192+
203193
Regex GetFloatingTagRegex(DockerfileInfo info) =>
204194
GetTagRegex(
205195
versionType,

0 commit comments

Comments
 (0)