From 1787afb86170b549b626c61732db18d8da85b9ef Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Wed, 16 Jan 2019 13:47:16 +0100 Subject: [PATCH] dockerTools: buildLayeredImage passthru imageTag --- pkgs/build-support/docker/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 731dd1ea992..22b4383341d 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -537,14 +537,19 @@ rec { buildInputs = [ jshon pigz coreutils findutils jq ]; # Image name and tag must be lowercase imageName = lib.toLower name; - imageTag = if tag == null then "" else lib.toLower tag; baseJson = configJson; + passthru.imageTag = + if tag == null + then lib.head (lib.splitString "-" (lib.last (lib.splitString "/" result))) + else lib.toLower tag; } '' - ${lib.optionalString (tag == null) '' + ${if (tag == null) then '' outName="$(basename "$out")" outHash=$(echo "$outName" | cut -d - -f 1) imageTag=$outHash + '' else '' + imageTag="${tag}" ''} find ${bulkLayers} -mindepth 1 -maxdepth 1 | sort -t/ -k5 -n > layer-list