mirror of
https://github.com/nlewo/nix2container.git
synced 2024-09-11 16:36:39 +03:00
Add getManifest items to test suite.
This commit is contained in:
parent
69a2fb754d
commit
41494c6c0a
@ -131,9 +131,9 @@ let
|
||||
|
||||
pullImageByManifest =
|
||||
{ imageName
|
||||
, imageManifest
|
||||
, imageManifest ? null
|
||||
# The manifest dictates what is pulled; these three are only used for
|
||||
# the supplied manifest-updating scripts.
|
||||
# the supplied manifest-pulling script.
|
||||
, imageTag ? "latest"
|
||||
, os ? "linux"
|
||||
, arch ? pkgs.go.GOARCH
|
||||
@ -194,7 +194,7 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
in pkgs.runCommand "nix2container-${imageName}.json" { inherit getManifest; } ''
|
||||
in pkgs.runCommand "nix2container-${imageName}.json" { passthru = { inherit getManifest; }; } ''
|
||||
${nix2container-bin}/bin/nix2container image-from-manifest $out ${imageManifest} ${blobMapFile}
|
||||
'';
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
nonReproducible = pkgs.callPackage ./non-reproducible.nix { inherit nix2container; };
|
||||
fromImage = pkgs.callPackage ./from-image.nix { inherit nix2container; };
|
||||
fromImageManifest = pkgs.callPackage ./from-image-manifest.nix { inherit nix2container; };
|
||||
getManifest = pkgs.callPackage ./get-manifest.nix { inherit nix2container; };
|
||||
uwsgi = pkgs.callPackage ./uwsgi { inherit nix2container; };
|
||||
openbar = pkgs.callPackage ./openbar.nix { inherit nix2container; };
|
||||
layered = pkgs.callPackage ./layered.nix { inherit nix2container; };
|
||||
|
@ -1,10 +1,14 @@
|
||||
{ pkgs, nix2container }: let
|
||||
# nix run .#examples.fromImageManifest.fromImage.getManifest > examples/alpine-manifest.json
|
||||
alpine = nix2container.pullImageByManifest {
|
||||
imageName = "library/alpine";
|
||||
# nix run .#examples.fromImageManifest.fromImage.getManifest > examples/alpine-manifest.json
|
||||
imageManifest = ./alpine-manifest.json;
|
||||
|
||||
# These attributes aren't checked against the manifest; they are only
|
||||
# used to populate the supplied getManifest script.
|
||||
imageTag = "latest";
|
||||
os = "linux";
|
||||
arch = "amd64";
|
||||
imageManifest = ./alpine-manifest.json;
|
||||
};
|
||||
in
|
||||
nix2container.buildImage {
|
||||
|
21
examples/get-manifest.nix
Normal file
21
examples/get-manifest.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ nix2container }:
|
||||
{
|
||||
images = {
|
||||
multiArch = nix2container.pullImageByManifest {
|
||||
imageName = "library/alpine";
|
||||
os = "linux";
|
||||
arch = "amd64";
|
||||
};
|
||||
|
||||
singleArch = nix2container.pullImageByManifest {
|
||||
imageName = "rancher/systemd-node";
|
||||
imageTag = "v0.0.4";
|
||||
};
|
||||
|
||||
quayio = nix2container.pullImageByManifest {
|
||||
imageName = "containers/podman";
|
||||
imageTag = "v4.5";
|
||||
registryUrl = "quay.io";
|
||||
};
|
||||
};
|
||||
}
|
@ -129,7 +129,6 @@ let
|
||||
# The file test2.txt should not have 777 perms
|
||||
pattern = "^-r--r--r-- 1 0 0 0 Jan 1 1970 test2.txt";
|
||||
};
|
||||
|
||||
copyToRoot = testScript {
|
||||
image = nix2container.buildImage {
|
||||
name = "copy-to-root";
|
||||
@ -138,7 +137,18 @@ let
|
||||
};
|
||||
pattern = "Hello, world!";
|
||||
};
|
||||
};
|
||||
} //
|
||||
(pkgs.lib.mapAttrs' (name: drv: {
|
||||
name = "${name}GetManifest";
|
||||
value = pkgs.writeScriptBin "test-script" ''
|
||||
set -e
|
||||
# Don't pipe directly here, as we don't want to swallow a return code.
|
||||
manifest=$(${drv.getManifest}/bin/get-manifest)
|
||||
echo "$manifest" | ${pkgs.jq}/bin/jq -e 'has("layers")' > /dev/null
|
||||
echo "Test Passed"
|
||||
'';
|
||||
}) examples.getManifest.images);
|
||||
|
||||
all =
|
||||
let scripts =
|
||||
pkgs.lib.concatStringsSep
|
||||
|
Loading…
Reference in New Issue
Block a user