Skip to content

Commit

Permalink
fix: add else statement for when hadolint isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
jbergstroem committed Feb 2, 2024
1 parent 4a881bd commit 7650443
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ shopt -s nullglob globstar
VERSION=${version:-}

DOWNLOAD="false"
# Check if hadolint exists
# Check if hadolint is installed and compare versions to decide
# if we should download a new version
if [ -x "$(command -v hadolint)" ]; then
INSTALLED_VERSION=$(hadolint --version | cut -d " " -f 4 2>&1)
echo "::debug::Found existing Hadolint version: ${INSTALLED_VERSION}"
if [ "${INSTALLED_VERSION}" != "${VERSION}" ]; then
echo "::debug::Hadolint version (${INSTALLED_VERSION}) does not match requested version (${VERSION})"
DOWNLOAD="true"
fi
else
DOWNLOAD="true"
fi

# Download hadolint if necessary
Expand All @@ -32,7 +35,4 @@ if [ "${DOWNLOAD}" == "true" ]; then
chmod +x /usr/local/bin/hadolint
fi

echo $PATH

echo "::debug:: $(hadolint --version | cut -d " " -f 4 2>&1) installed successfully"

0 comments on commit 7650443

Please sign in to comment.