about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJoel Höner <athre0z@zyantific.com>2024-02-17 17:48:57 +0100
committerJoel Höner <athre0z@zyantific.com>2024-02-17 18:52:42 +0100
commit4b603ad9cd26f71bd17d52c2f6923ce6ba163c63 (patch)
tree0126a47239e6db80ad26ad7a14dcc40a3e80708c /nixos
parentaf435645aed2bd50acad1f0866f3a6285de25e99 (diff)
downloadnixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.gz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.bz2
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.lz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.xz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.zst
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.zip
dockerTools: configurable compression schema
This commit adds support for swapping out the compression algorithm
used in all major docker-tools commands that generate images. The
default algorithm remains unchanged (gzip).
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/docker-tools.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 90af817e75ed..0d28a39712c6 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -128,6 +128,15 @@ in {
         docker.succeed("docker images --format '{{.Tag}}' | grep -F '${examples.nixLayered.imageTag}'")
         docker.succeed("docker rmi ${examples.nixLayered.imageName}")
 
+    with subtest("Check that images with alternative compression schemas load"):
+        docker.succeed(
+            "docker load --input='${examples.bashZstdCompressed}'",
+            "docker rmi ${examples.bashZstdCompressed.imageName}",
+        )
+        docker.succeed(
+            "docker load --input='${examples.bashUncompressed}'",
+            "docker rmi ${examples.bashUncompressed.imageName}",
+        )
 
     with subtest(
         "Check if the nix store is correctly initialized by listing "
@@ -449,6 +458,18 @@ in {
             "docker run --rm ${examples.layeredImageWithFakeRootCommands.imageName} /hello/bin/layeredImageWithFakeRootCommands-hello"
         )
 
+    with subtest("mergeImage correctly deals with varying compression schemas in inputs"):
+        docker.succeed("docker load --input='${examples.mergeVaryingCompressor}'")
+
+        for sub_image, tag in [
+            ("${examples.redis.imageName}", "${examples.redis.imageTag}"),
+            ("${examples.bashUncompressed.imageName}", "${examples.bashUncompressed.imageTag}"),
+            ("${examples.bashZstdCompressed.imageName}", "${examples.bashZstdCompressed.imageTag}"),
+        ]:
+            docker.succeed(f"docker images --format '{{{{.Repository}}}}-{{{{.Tag}}}}' | grep -F '{sub_image}-{tag}'")
+            docker.succeed(f"docker rmi {sub_image}")
+
+
     with subtest("exportImage produces a valid tarball"):
         docker.succeed(
             "tar -tf ${examples.exportBash} | grep '\./bin/bash' > /dev/null"