Add error context to image building functions

This commit is contained in:
Robert Hensing 2019-03-27 22:04:31 +01:00
parent cca1f68a4f
commit f789d163cc

View file

@ -7,11 +7,13 @@ let
lib.filterAttrs filterFunction config.docker-compose.evaluatedServices lib.filterAttrs filterFunction config.docker-compose.evaluatedServices
); );
filterFunction = _serviceName: service: filterFunction = serviceName: service:
service.config.image.nixBuild; builtins.addErrorContext "while evaluating whether the service ${serviceName} defines an image"
service.config.image.nixBuild;
addDetails = _serviceName: service: addDetails = serviceName: service:
let builtins.addErrorContext "while evaluating the image for service ${serviceName}"
(let
inherit (service.config) build; inherit (service.config) build;
in { in {
image = build.image.outPath; image = build.image.outPath;
@ -20,7 +22,7 @@ let
if build.image.imageTag != "" if build.image.imageTag != ""
then build.image.imageTag then build.image.imageTag
else lib.head (lib.strings.splitString "-" (baseNameOf build.image.outPath)); else lib.head (lib.strings.splitString "-" (baseNameOf build.image.outPath));
}; });
in in
{ {
options = { options = {