Skip to content

Commit

Permalink
Merge pull request #26 from hashicorp/update-error-message
Browse files Browse the repository at this point in the history
add context to version label validation
  • Loading branch information
alvin-huang authored Aug 17, 2022
2 parents 47f82d0 + 2aeeef5 commit 5e62306
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/docker_build
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5e62306

Please sign in to comment.