Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions hadoop-ozone/dev-support/checks/hadolint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,21 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/../../.." || exit 1
REPO_DIR="$DIR/../../.."

ERROR=0
REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/hadolint"}
mkdir -p "$REPORT_DIR"
REPORT_FILE="$REPORT_DIR/summary.txt"
echo -n > "$REPORT_FILE"


for Dockerfile in $(find "$REPO_DIR/hadoop-ozone" "$REPO_DIR/hadoop-hdds" -name Dockerfile | sort); do
echo "Checking $Dockerfile"

result=$( hadolint $Dockerfile )
if [ ! -z "$result" ]
then
echo "$result"
echo ""
ERROR=1
fi
for Dockerfile in $(find hadoop-ozone hadoop-hdds -name Dockerfile | sort); do
hadolint $Dockerfile | tee -a "$REPORT_FILE"
done

if [ "$ERROR" = 1 ]
wc -l "$REPORT_FILE" | awk '{print $1}'> "$REPORT_DIR/failures"

if [ -s "${REPORT_FILE}" ]
then
echo ""
echo ""
echo "Hadolint errors were found. Exit code: 1."
echo "" | tee -a "$REPORT_FILE"
echo "" | tee -a "$REPORT_FILE"
echo "Hadolint errors were found. Exit code: 1." | tee -a "$REPORT_FILE"
exit 1
fi