Skip to content

Commit 72deab5

Browse files
authored
Add chisel manifest slice to .NET 10 noble images (#6176)
1 parent 257c71a commit 72deab5

File tree

8 files changed

+47
-0
lines changed

8 files changed

+47
-0
lines changed

eng/dockerfile-templates/runtime-deps/Dockerfile.chiseled-ubuntu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
] ^
2929

3030
set basePkgs to when (dotnetVersion = "8.0", cat(basePkgs, ["zlib1g_libs"]), basePkgs) ^
31+
set basePkgs to when (dotnetVersion != "8.0" && dotnetVersion != "9.0", cat(basePkgs, ["base-files_chisel"]), basePkgs) ^
3132

3233
_ Arrays in cottle are actually key-value maps. Sorting the array sorts by value
3334
but does not change the key value. In order to have the right index in the

src/runtime-deps/10.0/noble-chiseled-extra/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

src/runtime-deps/10.0/noble-chiseled-extra/arm32v7/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

src/runtime-deps/10.0/noble-chiseled-extra/arm64v8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

src/runtime-deps/10.0/noble-chiseled/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

src/runtime-deps/10.0/noble-chiseled/arm32v7/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

src/runtime-deps/10.0/noble-chiseled/arm64v8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /rootfs/var/lib/dpkg/ \
2727
&& chisel-wrapper --generate-dpkg-status /rootfs/var/lib/dpkg/status -- \
2828
--release ubuntu-24.04 --root /rootfs \
2929
base-files_base \
30+
base-files_chisel \
3031
base-files_release-info \
3132
ca-certificates_data \
3233
libc6_libs \

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,46 @@ public void VerifyDistrolessOSReleaseInfo(ProductImageData imageData)
121121
Assert.NotEmpty(GetOSReleaseInfo(imageData, ImageRepo, DockerHelper));
122122
}
123123

124+
/// <summary>
125+
/// Verifies the presence of the Chisel manifest in Ubuntu Chiseled images. Chisel manifest documentation:
126+
/// https://discourse.ubuntu.com/t/chisel-manifest-is-supported-in-newly-released-v1-0-0/48944
127+
/// </summary>
128+
[LinuxImageTheory]
129+
[MemberData(nameof(GetImageData))]
130+
public void VerifyChiselManifest(ProductImageData imageData)
131+
{
132+
if (!imageData.OS.Contains(OS.ChiseledSuffix))
133+
{
134+
OutputHelper.WriteLine("Test is only relevant to Ubuntu Chiseled images");
135+
return;
136+
}
137+
138+
// https://github.com/dotnet/dotnet-docker/issues/5973#issuecomment-2501510550
139+
bool shouldContainManifest = imageData.Version.Major != 8 && imageData.Version.Major != 9;
140+
141+
const string RootFs = "/rootfs";
142+
const string ChiselManifestFileName = "/var/lib/chisel/manifest.wall";
143+
144+
// Setup a distroless helper image to inspect the filesystem of the Chiseled image
145+
string distrolessHelperImageTag = DockerHelper.BuildDistrolessHelper(ImageRepo, imageData, RootFs);
146+
147+
// Check for the presence of the Chisel manifest by listing the files in the directory
148+
// and then verifying the output.
149+
string actualOutput = DockerHelper.Run(
150+
image: distrolessHelperImageTag,
151+
name: imageData.GetIdentifier(nameof(VerifyChiselManifest)),
152+
command: $"find {RootFs}/var/lib/ -path *chisel* -type f");
153+
154+
if (shouldContainManifest)
155+
{
156+
Assert.Contains(ChiselManifestFileName, actualOutput);
157+
}
158+
else
159+
{
160+
Assert.DoesNotContain(ChiselManifestFileName, actualOutput);
161+
}
162+
}
163+
124164
private static string GetOSReleaseInfo(
125165
ProductImageData imageData,
126166
DotNetImageRepo imageRepo,

0 commit comments

Comments
 (0)