From 0fb1c5a82a6952f41e8391f6bef52ac3cbe4f546 Mon Sep 17 00:00:00 2001 From: "yiyang.zhou" Date: Tue, 12 Jan 2021 11:28:53 +0800 Subject: [PATCH 1/4] HDDS-2402. Adapt hadolint check to improved CI framework --- hadoop-ozone/dev-support/checks/hadolint.sh | 27 ++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/hadoop-ozone/dev-support/checks/hadolint.sh b/hadoop-ozone/dev-support/checks/hadolint.sh index f811b4f4010f..05daeed39a4d 100755 --- a/hadoop-ozone/dev-support/checks/hadolint.sh +++ b/hadoop-ozone/dev-support/checks/hadolint.sh @@ -17,25 +17,30 @@ 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" for Dockerfile in $(find "$REPO_DIR/hadoop-ozone" "$REPO_DIR/hadoop-hdds" -name Dockerfile | sort); do - echo "Checking $Dockerfile" + echo "Checking $Dockerfile" | tee -a "$REPORT_FILE" result=$( hadolint $Dockerfile ) if [ ! -z "$result" ] then - echo "$result" - echo "" - ERROR=1 + echo "$result" | tee -a "$REPORT_FILE" + echo "" | tee -a "$REPORT_FILE" fi done -if [ "$ERROR" = 1 ] +cat "$REPORT_FILE" | egrep -v '^$|^Checking' | wc -l | awk '{print $1}'> "$REPORT_DIR/failures" + +if [ -s "${REPORT_FILE}" ] then - echo "" - echo "" - echo "Hadolint errors were found. Exit code: 1." - exit 1 + echo "" | tee -a "$REPORT_FILE" + echo "" | tee -a "$REPORT_FILE" + echo "Hadolint errors were found. Exit code: 1." | tee -a "$REPORT_FILE" +fi + +if [[ -s "${REPORT_FILE}" ]]; then + exit 1 fi From 5c5dd03f6bf01889d0e0500cf8ad5608e82dc2b3 Mon Sep 17 00:00:00 2001 From: "yiyang.zhou" Date: Wed, 13 Jan 2021 21:29:25 +0800 Subject: [PATCH 2/4] HDDS-2402. To simplify the script --- hadoop-ozone/dev-support/checks/hadolint.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hadoop-ozone/dev-support/checks/hadolint.sh b/hadoop-ozone/dev-support/checks/hadolint.sh index 05daeed39a4d..2b8105487ebd 100755 --- a/hadoop-ozone/dev-support/checks/hadolint.sh +++ b/hadoop-ozone/dev-support/checks/hadolint.sh @@ -21,26 +21,20 @@ REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/hadolint"} mkdir -p "$REPORT_DIR" REPORT_FILE="$REPORT_DIR/summary.txt" -for Dockerfile in $(find "$REPO_DIR/hadoop-ozone" "$REPO_DIR/hadoop-hdds" -name Dockerfile | sort); do - echo "Checking $Dockerfile" | tee -a "$REPORT_FILE" - +for Dockerfile in $(find hadoop-ozone hadoop-hdds -name Dockerfile | sort); do result=$( hadolint $Dockerfile ) if [ ! -z "$result" ] then echo "$result" | tee -a "$REPORT_FILE" - echo "" | tee -a "$REPORT_FILE" fi done -cat "$REPORT_FILE" | egrep -v '^$|^Checking' | wc -l | awk '{print $1}'> "$REPORT_DIR/failures" +wc -l "$REPORT_FILE" | awk '{print $1}'> "$REPORT_DIR/failures" if [ -s "${REPORT_FILE}" ] then echo "" | tee -a "$REPORT_FILE" echo "" | tee -a "$REPORT_FILE" echo "Hadolint errors were found. Exit code: 1." | tee -a "$REPORT_FILE" -fi - -if [[ -s "${REPORT_FILE}" ]]; then - exit 1 + exit 1 fi From 8f91ed13f4801bec4565ddeba2c28f0c6482bc3e Mon Sep 17 00:00:00 2001 From: "yiyang.zhou" Date: Thu, 14 Jan 2021 20:06:07 +0800 Subject: [PATCH 3/4] HDDS-2402. Simplify loop body --- hadoop-ozone/dev-support/checks/hadolint.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hadoop-ozone/dev-support/checks/hadolint.sh b/hadoop-ozone/dev-support/checks/hadolint.sh index 2b8105487ebd..63291a711942 100755 --- a/hadoop-ozone/dev-support/checks/hadolint.sh +++ b/hadoop-ozone/dev-support/checks/hadolint.sh @@ -20,13 +20,10 @@ REPO_DIR="$DIR/../../.." 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 hadoop-ozone hadoop-hdds -name Dockerfile | sort); do - result=$( hadolint $Dockerfile ) - if [ ! -z "$result" ] - then - echo "$result" | tee -a "$REPORT_FILE" - fi + hadolint $Dockerfile | tee -a "$REPORT_FILE" done wc -l "$REPORT_FILE" | awk '{print $1}'> "$REPORT_DIR/failures" From 13a35835df6ef09b453d2605423ed8a7e433db1b Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Fri, 15 Jan 2021 09:13:28 +0100 Subject: [PATCH 4/4] trigger new CI check