git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #54270 from xtruder/build-support/docker/layered_image_tag_passthru

dockerTools: buildLayeredImage passthru imageTag

commit105ffa445d8d50a06edcc0397699932c3c8ebf3f authorlewo <lewo@abesis.fr> dateSun 20 Jan 2019, 12:21 (8 years ago) parent5ba532f1787afb
1 file changed+7−2
pkgs/build-support/docker/default.nix+7−2
pkgs/build-support/docker/default.nix+7−2
@@ -544,14 +544,19 @@ rec {
544544 buildInputs = [ jshon pigz coreutils findutils jq ];
545545 # Image name and tag must be lowercase
546546 imageName = lib.toLower name;
547− imageTag = if tag == null then "" else lib.toLower tag;
548547 baseJson = configJson;
548+ passthru.imageTag =
549+ if tag == null
550+ then lib.head (lib.splitString "-" (lib.last (lib.splitString "/" result)))
551+ else lib.toLower tag;
549552 } ''
550− ${lib.optionalString (tag == null) ''
553+ ${if (tag == null) then ''
551554 outName="$(basename "$out")"
552555 outHash=$(echo "$outName" | cut -d - -f 1)
553556
554557 imageTag=$outHash
558+ '' else ''
559+ imageTag="${tag}"
555560 ''}
556561
557562 find ${bulkLayers} -mindepth 1 -maxdepth 1 | sort -t/ -k5 -n > layer-list