Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Build Ubuntu 22.04 Docker image #3148

Merged
merged 2 commits into from
Aug 17, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ jobs:
strategy:
matrix:
targetFramework: [ '3.1', '6.0' ]
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ]
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
fail-fast: false

steps:
Expand Down Expand Up @@ -289,7 +289,7 @@ jobs:
strategy:
matrix:
targetFramework: [ '3.1', '6.0' ]
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ]
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsDotnetToolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;

var cmd = $"{rootPrefix}/scripts/test-global-tool.sh --version {version} --nugetPath {rootPrefix}/nuget --repoPath {rootPrefix}/repo";

Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsMsBuildCoreTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;

string distro = dockerImage.Distro;
string targetFramework = dockerImage.TargetFramework;
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsNativeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;

var runtime = dockerImage.Architecture == Architecture.Amd64 ? "linux-x64" : "linux-arm64";
if (dockerImage.Distro.StartsWith("alpine"))
Expand Down
2 changes: 1 addition & 1 deletion build/artifacts/Tasks/ArtifactsPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;
context.DockerPullImage(dockerImage);
}
}
Expand Down
4 changes: 3 additions & 1 deletion build/common/Utilities/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class Constants
public const string Fedora33 = "fedora.33";
public const string Ubuntu1804 = "ubuntu.18.04";
public const string Ubuntu2004 = "ubuntu.20.04";
public const string Ubuntu2204 = "ubuntu.22.04";
public const string DockerDistroLatest = Debian10;
public static readonly string[] DockerDistrosToBuild =
{
Expand All @@ -50,7 +51,8 @@ public class Constants
Debian11,
Fedora33,
Ubuntu1804,
Ubuntu2004
Ubuntu2004,
Ubuntu2204
};
public const string NugetOrgUrl = "https://api.nuget.org/v3/index.json";
public const string GithubPackagesUrl = "https://nuget.pkg.github.com/gittools/index.json";
Expand Down
13 changes: 9 additions & 4 deletions build/common/Utilities/DockerContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ public enum Architecture
}
public static class DockerContextExtensions
{
public static bool SkipArm64Image(this ICakeContext context, DockerImage dockerImage)
public static bool SkipImage(this ICakeContext context, DockerImage dockerImage)
{
if (dockerImage.Architecture != Architecture.Arm64) return false;
if (!Constants.DistrosToSkip.Contains(dockerImage.Distro)) return false;
var (distro, targetFramework, architecture, _, _) = dockerImage;

context.Information($"Skipping Target: {dockerImage.TargetFramework}, Distro: {dockerImage.Distro}, Arch: {dockerImage.Architecture}");
// TODO skip this because of https://github.com/GitTools/GitVersion/pull/3148, remove after .net core 3.1 is removed
if (distro == Constants.Ubuntu2204 && targetFramework == Constants.Version31) return true;

if (architecture != Architecture.Arm64) return false;
if (!Constants.DistrosToSkip.Contains(distro)) return false;

context.Information($"Skipping Target: {targetFramework}, Distro: {distro}, Arch: {architecture}");
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Run(BuildContext context)

foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;
context.DockerBuildImage(dockerImage);
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override void Run(BuildContext context)
{
var amd64DockerImage = group.First(x => x.Architecture == Architecture.Amd64);
var arm64DockerImage = group.First(x => x.Architecture == Architecture.Arm64);
context.DockerCreateManifest(amd64DockerImage, context.SkipArm64Image(arm64DockerImage));
context.DockerCreateManifest(amd64DockerImage, context.SkipImage(arm64DockerImage));
context.DockerPushManifest(amd64DockerImage);
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerPublish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;
context.DockerPushImage(dockerImage);
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Tasks/DockerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void Run(BuildContext context)
{
foreach (var dockerImage in context.Images)
{
if (context.SkipArm64Image(dockerImage)) continue;
if (context.SkipImage(dockerImage)) continue;
context.DockerTestImage(dockerImage);
}
}
Expand Down