Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions src/azurelinux/3.0/net11.0/source-build-test/amd64/Dockerfile

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:10.0-azurelinux3.0-amd64 AS installer
ARG DOTNET_VERSION
FROM mcr.microsoft.com/dotnet/sdk:$DOTNET_VERSION-azurelinux3.0-amd64 AS installer

# Install dependencies for building pyicu wheel from source (dependency of scancode-toolkit)
RUN tdnf update -y \
Expand All @@ -21,7 +22,7 @@ RUN SCANCODE_VERSION="32.4.1" \
&& pip install click==8.2.2


FROM mcr.microsoft.com/dotnet/sdk:10.0-azurelinux3.0-amd64
FROM mcr.microsoft.com/dotnet/sdk:$DOTNET_VERSION-azurelinux3.0-amd64

COPY --from=installer /venv /venv

Expand Down
49 changes: 44 additions & 5 deletions src/azurelinux/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1337,11 +1337,11 @@
"platforms": [
{
"architecture": "amd64",
"dockerfile": "src/azurelinux/3.0/net10.0/source-build-test/amd64",
"dockerfile": "src/azurelinux/3.0/net11.0/build/amd64",
"os": "linux",
"osVersion": "azurelinux3.0",
"tags": {
"azurelinux-3.0-net10.0-source-build-test-amd64": {}
"azurelinux-3.0-net11.0-build-amd64": {}
}
}
]
Expand All @@ -1350,11 +1350,46 @@
"platforms": [
{
"architecture": "amd64",
"dockerfile": "src/azurelinux/3.0/net11.0/build/amd64",
"dockerfile": "src/azurelinux/3.0/net8.0/source-build-test/amd64",
"os": "linux",
"osVersion": "azurelinux3.0",
"tags": {
"azurelinux-3.0-net11.0-build-amd64": {}
"azurelinux-3.0-net8.0-source-build-test-amd64": {}
},
"buildArgs": {
"DOTNET_VERSION": "8.0"
}
}
]
},
{
"platforms": [
{
"architecture": "amd64",
"dockerfile": "src/azurelinux/3.0/net8.0/source-build-test/amd64",
"os": "linux",
"osVersion": "azurelinux3.0",
"tags": {
"azurelinux-3.0-9.0-source-build-test-amd64": {}
},
"buildArgs": {
"DOTNET_VERSION": "9.0"
}
}
]
},
{
"platforms": [
{
"architecture": "amd64",
"dockerfile": "src/azurelinux/3.0/net8.0/source-build-test/amd64",
"os": "linux",
"osVersion": "azurelinux3.0",
"tags": {
"azurelinux-3.0-net10.0-source-build-test-amd64": {}
},
"buildArgs": {
"DOTNET_VERSION": "10.0"
}
}
]
Expand All @@ -1363,11 +1398,15 @@
"platforms": [
{
"architecture": "amd64",
"dockerfile": "src/azurelinux/3.0/net11.0/source-build-test/amd64",
"dockerfile": "src/azurelinux/3.0/net8.0/source-build-test/amd64",
"os": "linux",
"osVersion": "azurelinux3.0",
"tags": {
"azurelinux-3.0-net11.0-source-build-test-amd64": {}
},
"buildArgs": {
// TODO: Update to 11 once images are available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will log a tracking issue for this once merged.

"DOTNET_VERSION": "10.0"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public void ValidateFolderStructure()
}
else
{
var matchingPlatforms = platforms.Where(p => GetDockerfilePath(p) == dockerfilePath);
var matchingPlatforms = platforms.Where(p => GetDockerfilePath(p) == dockerfilePath).ToList();
if (matchingPlatforms.Count() > 1)
{
if (dockerfilePath.EndsWith(arch))
var distinctArchs = matchingPlatforms.Select(p => GetArchitecture(p)).Distinct();
if (distinctArchs.Count() > 1 && dockerfilePath.EndsWith(arch))
{
invalidDockerfilePaths.Add(
$"Dockerfile path '{dockerfilePath}' should not end with '{arch}' because it is built for multiple platforms.");
$"Dockerfile path '{dockerfilePath}' should not end with '{arch}' because it is built for multiple platforms with different architectures.");
}
}
else if (!dockerfilePath.EndsWith(arch))
Expand Down Expand Up @@ -78,6 +79,14 @@ public void ValidateTags()
return;
}

// Skip validation if this dockerfile is shared across multiple platforms
// as there is no easy way to validate the tag structure from the Dockerfile path.
var matchingPlatforms = platforms.Where(p => GetDockerfilePath(p) == dockerfilePath);
if (matchingPlatforms.Count() > 1)
{
return;
}

string expectedTag = dockerfilePath;
string dockerfileQualifier = string.Empty;
if (!dockerfilePath.EndsWith(arch) && !IsCrossDockerfile(dockerfilePath))
Expand Down Expand Up @@ -107,11 +116,15 @@ public void ValidateTags()
private void EnumerateManifests(Action<JsonElement[], JsonElement, string, string> action)
{
var manifestFiles = Directory.GetFiles(Config.SrcDirectory, "manifest.json", SearchOption.AllDirectories);
var jsonOptions = new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip,
};

foreach (var manifestFile in manifestFiles)
{
OutputHelper.WriteLine($"Processing manifest file: {manifestFile}");
var manifestJson = JsonDocument.Parse(File.ReadAllText(manifestFile)).RootElement;
var manifestJson = JsonDocument.Parse(File.ReadAllText(manifestFile), jsonOptions).RootElement;
var platforms = manifestJson.GetProperty("repos")
.EnumerateArray()
.SelectMany(repo => repo.GetProperty("images").EnumerateArray())
Expand All @@ -128,7 +141,7 @@ private void EnumerateManifests(Action<JsonElement[], JsonElement, string, strin
}
}

private string GetArchitecture(JsonElement platform)
private static string GetArchitecture(JsonElement platform)
{
string variant = platform.TryGetProperty("variant", out var variantProp) ? variantProp.GetString()! : string.Empty;
string arch = platform.TryGetProperty("architecture", out var archProp) ? archProp.GetString()! : DefaultArch;
Expand All @@ -141,7 +154,7 @@ private string GetArchitecture(JsonElement platform)
return arch + variant;
}

private string GetDockerfilePath(JsonElement platform) => (platform.GetProperty("dockerfile").GetString() ?? string.Empty).TrimEnd('/');
private static string GetDockerfilePath(JsonElement platform) => (platform.GetProperty("dockerfile").GetString() ?? string.Empty).TrimEnd('/');

private bool IsCrossDockerfile(string dockerfilePath) => dockerfilePath.Contains("/cross/");
private static bool IsCrossDockerfile(string dockerfilePath) => dockerfilePath.Contains("/cross/");
}