Skip to content

Commit

Permalink
update entrypoint.sh to take care of possible network\installation is…
Browse files Browse the repository at this point in the history
…sues and timeouts

Add precondition detection:
The installation of reviewdog in the container will fail if there is a network timeout. Therefore, if reviewdog does not exist, exit directly to avoid finding the problem after downloading checkstyle, which is a waste of time.

Downloading checkstyle theory also takes time. Before time-consuming operation (non-real-time response), output log feedback current process.
# Conflicts:
#	entrypoint.sh
  • Loading branch information
kerwin612 authored and dbelyaev committed Jul 28, 2023
1 parent a91e58c commit bc38f54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

echo "Running check"

command -v reviewdog >/dev/null 2>&1 || { echo >&2 "reviewdog: not found"; exit 1; }

set -e

if [ -n "${GITHUB_WORKSPACE}" ] ; then
Expand All @@ -18,6 +20,7 @@ printenv
ls

# fetch checkstyle of a requested version
echo "Downloading Checkstyle v${INPUT_CHECKSTYLE_VERSION}"
wget -O - -q "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${INPUT_CHECKSTYLE_VERSION}/checkstyle-${INPUT_CHECKSTYLE_VERSION}-all.jar" > /checkstyle.jar

exec java -jar /checkstyle.jar "${INPUT_WORKDIR}" -c "${INPUT_CHECKSTYLE_CONFIG}" "${INPUT_WORKDIR}" ${OPT_PROPERTIES_FILE} -f xml \
Expand Down

0 comments on commit bc38f54

Please sign in to comment.