From 4baaab186448dd6446521389ec049a50cfa9af59 Mon Sep 17 00:00:00 2001 From: Andrew Hobson Date: Wed, 2 Feb 2022 15:33:11 -0500 Subject: [PATCH] Fallback hadolint arm64 binary to x86_64 --- pre-commit-hadolint | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pre-commit-hadolint b/pre-commit-hadolint index 18baa34..ff72490 100755 --- a/pre-commit-hadolint +++ b/pre-commit-hadolint @@ -6,9 +6,17 @@ HADOLINT_PREFIX_URL="https://github.com/hadolint/hadolint/releases/download" HADOLINT_VERSION="v2.1.0" OS=$(uname -s) ARCH=$(uname -m) + +# so far, hadolint is not providing arm64 binaries +if [[ "$ARCH" = "arm64" ]]; then + # fallback to x86 and hope for runtime translation on macOS + ARCH=x86_64 +fi + HADOLINT_BINARY="hadolint-${OS}-${ARCH}" HADOLINT_URL="${HADOLINT_PREFIX_URL}/${HADOLINT_VERSION}/${HADOLINT_BINARY}" + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" LOCAL_BINARY="${DIR}/${HADOLINT_BINARY}-${HADOLINT_VERSION}"