Merge pull request #167287 from qowoz/dockertools

dockerTools: various
This commit is contained in:
Robert Hensing 2022-04-05 09:42:26 +02:00 committed by GitHub
commit 7dabcdbcf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 11 deletions

5
.github/CODEOWNERS vendored
View file

@ -242,9 +242,8 @@
# Docker tools # Docker tools
/pkgs/build-support/docker @roberth /pkgs/build-support/docker @roberth
/nixos/tests/docker-tools-overlay.nix @roberth /nixos/tests/docker-tools* @roberth
/nixos/tests/docker-tools.nix @roberth /doc/builders/images/dockertools.section.md @roberth
/doc/builders/images/dockertools.xml @roberth
# Blockchains # Blockchains
/pkgs/applications/blockchains @mmahut @RaghavSood /pkgs/applications/blockchains @mmahut @RaghavSood

View file

@ -7,7 +7,7 @@ import ./make-test-python.nix ({ pkgs, ... }:
let let
remoteSystem = remoteSystem =
if pkgs.system == "aarch64-linux" if pkgs.stdenv.hostPlatform.system == "aarch64-linux"
then "x86_64-linux" then "x86_64-linux"
else "aarch64-linux"; else "aarch64-linux";
@ -18,7 +18,7 @@ let
# NOTE: Since this file can't control where the test will be _run_ we don't # NOTE: Since this file can't control where the test will be _run_ we don't
# cross-compile _to_ a different system but _from_ a different system # cross-compile _to_ a different system but _from_ a different system
crossSystem = pkgs.system; crossSystem = pkgs.stdenv.hostPlatform.system;
}; };
hello1 = remoteCrossPkgs.dockerTools.buildImage { hello1 = remoteCrossPkgs.dockerTools.buildImage {

View file

@ -315,7 +315,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
"docker inspect ${pkgs.dockerTools.examples.cross.imageName} " "docker inspect ${pkgs.dockerTools.examples.cross.imageName} "
+ "| ${pkgs.jq}/bin/jq -r .[].Architecture" + "| ${pkgs.jq}/bin/jq -r .[].Architecture"
).strip() ).strip()
== "${if pkgs.system == "aarch64-linux" then "amd64" else "arm64"}" == "${if pkgs.stdenv.hostPlatform.system == "aarch64-linux" then "amd64" else "arm64"}"
) )
with subtest("buildLayeredImage doesn't dereference /nix/store symlink layers"): with subtest("buildLayeredImage doesn't dereference /nix/store symlink layers"):

View file

@ -16,8 +16,8 @@
, makeWrapper , makeWrapper
, moreutils , moreutils
, nix , nix
, nixosTests
, pigz , pigz
, pkgs
, rsync , rsync
, runCommand , runCommand
, runtimeShell , runtimeShell
@ -26,6 +26,7 @@
, storeDir ? builtins.storeDir , storeDir ? builtins.storeDir
, substituteAll , substituteAll
, symlinkJoin , symlinkJoin
, tarsum
, util-linux , util-linux
, vmTools , vmTools
, writeReferencesToFile , writeReferencesToFile
@ -81,6 +82,15 @@ rec {
inherit buildImage buildLayeredImage fakeNss pullImage shadowSetup buildImageWithNixDb; inherit buildImage buildLayeredImage fakeNss pullImage shadowSetup buildImageWithNixDb;
}; };
tests = {
inherit (nixosTests)
docker-tools
docker-tools-overlay
# requires remote builder
# docker-tools-cross
;
};
pullImage = pullImage =
let let
fixName = name: builtins.replaceStrings [ "/" ":" ] [ "-" "-" ] name; fixName = name: builtins.replaceStrings [ "/" ":" ] [ "-" "-" ] name;
@ -113,7 +123,7 @@ rec {
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHash = sha256; outputHash = sha256;
nativeBuildInputs = lib.singleton skopeo; nativeBuildInputs = [ skopeo ];
SSL_CERT_FILE = "${cacert.out}/etc/ssl/certs/ca-bundle.crt"; SSL_CERT_FILE = "${cacert.out}/etc/ssl/certs/ca-bundle.crt";
sourceURL = "docker://${imageName}@${imageDigest}"; sourceURL = "docker://${imageName}@${imageDigest}";
@ -132,7 +142,7 @@ rec {
# We need to sum layer.tar, not a directory, hence tarsum instead of nix-hash. # We need to sum layer.tar, not a directory, hence tarsum instead of nix-hash.
# And we cannot untar it, because then we cannot preserve permissions etc. # And we cannot untar it, because then we cannot preserve permissions etc.
tarsum = pkgs.tarsum; inherit tarsum; # pkgs.dockerTools.tarsum
# buildEnv creates symlinks to dirs, which is hard to edit inside the overlay VM # buildEnv creates symlinks to dirs, which is hard to edit inside the overlay VM
mergeDrvs = mergeDrvs =
@ -754,7 +764,7 @@ rec {
# "#!/usr/bin/env executable" shebang. # "#!/usr/bin/env executable" shebang.
usrBinEnv = runCommand "usr-bin-env" { } '' usrBinEnv = runCommand "usr-bin-env" { } ''
mkdir -p $out/usr/bin mkdir -p $out/usr/bin
ln -s ${pkgs.coreutils}/bin/env $out/usr/bin ln -s ${coreutils}/bin/env $out/usr/bin
''; '';
# This provides /bin/sh, pointing to bashInteractive. # This provides /bin/sh, pointing to bashInteractive.

View file

@ -486,7 +486,7 @@ rec {
cross = let cross = let
# Cross compile for x86_64 if on aarch64 # Cross compile for x86_64 if on aarch64
crossPkgs = crossPkgs =
if pkgs.system == "aarch64-linux" then pkgsCross.gnu64 if pkgs.stdenv.hostPlatform.system == "aarch64-linux" then pkgsCross.gnu64
else pkgsCross.aarch64-multiplatform; else pkgsCross.aarch64-multiplatform;
in crossPkgs.dockerTools.buildImage { in crossPkgs.dockerTools.buildImage {
name = "hello-cross"; name = "hello-cross";