Skip to content

Commit

Permalink
fix: use sudo to move binary to /usr/local/bin
Browse files Browse the repository at this point in the history
For self-hosted runners we need sudo for write permissions to `/usr/local/bin`.

PR: #145
Closes: #144
  • Loading branch information
jbergstroem committed Feb 5, 2024
1 parent 0e6b33f commit 39e5727
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ fi
# Download hadolint if necessary
if [ "${DOWNLOAD}" == "true" ]; then
echo "::debug::Downloading Hadolint ${VERSION}"
# https://github.com/actions/runner-images/issues/3727
# /usr/local/bin exists and is writable by any user
curl -s -L --fail -w 1 -o /tmp/hadolint \
"https://github.com/hadolint/hadolint/releases/download/v${VERSION}/hadolint-Linux-x86_64" ||
(echo "::error::Hadolint (version: ${VERSION}) could not be found. Exiting." && exit 1)
mv /tmp/hadolint /usr/local/bin/hadolint
chmod +x /usr/local/bin/hadolint
chmod +x /tmp/hadolint
# https://github.com/actions/runner-images/issues/3727
# /usr/local/bin exists and is writable by any user
# but some self hosted runners requires superpowers to write there
# https://github.com/jbergstroem/hadolint-gh-action/issues/144
sudo mv /tmp/hadolint /usr/local/bin/hadolint
fi

new_version=$(eval "${EXTRACT_VERSION_CMD}" 2>&1)
Expand Down

0 comments on commit 39e5727

Please sign in to comment.