From 543e87ac37c12943c8a619068bd9582301ed4df0 Mon Sep 17 00:00:00 2001 From: Andrew Hobson Date: Wed, 14 Apr 2021 13:17:06 +0000 Subject: [PATCH] Try more hoops for CircleCI hadolint --- pre-commit-hadolint | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pre-commit-hadolint b/pre-commit-hadolint index 5685c76..08a62c7 100755 --- a/pre-commit-hadolint +++ b/pre-commit-hadolint @@ -13,11 +13,14 @@ LOCAL_BINARY="${DIR}/${HADOLINT_BINARY}-${HADOLINT_VERSION}" # Download the binary if it doesn't already exist if [[ ! -x ${LOCAL_BINARY} ]]; then + tmp_local_binary="${LOCAL_BINARY}.new" # download to temp location and rename to prevent Text file busy - curl -o "${LOCAL_BINARY}.new" \ + curl -o "${tmp_local_binary}" \ -L -sSf "${HADOLINT_PREFIX_URL}/${HADOLINT_VERSION}/${HADOLINT_BINARY}" - chmod 755 "${LOCAL_BINARY}.new" - mv "${LOCAL_BINARY}.new" "${LOCAL_BINARY}" + # ensure the file is synced on CIRCLECI + [ -n "${CIRCLECI+x}" ] && sync + chmod 755 "${tmp_local_binary}" + mv "${tmp_local_binary}" "${LOCAL_BINARY}" fi files=()