From 2aeeef5579cdd4f16b4ec9f30dbce54f581248ee Mon Sep 17 00:00:00 2001 From: Alvin Huang <17609145+alvin-huang@users.noreply.github.com> Date: Wed, 17 Aug 2022 12:01:30 -0400 Subject: [PATCH] add context to version label validation --- scripts/docker_build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/docker_build b/scripts/docker_build index 874e7116..4fd36eed 100755 --- a/scripts/docker_build +++ b/scripts/docker_build @@ -77,10 +77,11 @@ docker buildx build --load \ # validate version label is set to the correct value version_label_validation() { val=$(docker inspect --format='{{ index .Config.Labels "version" }}' "${2}") + error_context="actions-docker-build passes a 'PRODUCT_VERSION' build-arg to the build. Ensure it is defined in the Dockerfile and the 'version' label uses it" if [ "$val" = "" ]; then - die "Error: 'version' label must be set to version passed in but was empty" + die "Error: 'version' label must be set to version passed in but was empty.\n$error_context" elif [ "$val" != "${1}" ]; then - die "Error: 'version' label must be set to version passed in but was ($val)" + die "Error: 'version' label must match the version passed in but was ($val).\n$error_context" fi }