adoroszlai commented on a change in pull request #1778:
URL: https://github.com/apache/ozone/pull/1778#discussion_r557264271



##########
File path: hadoop-ozone/dev-support/checks/hadolint.sh
##########
@@ -17,25 +17,24 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 
2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 REPO_DIR="$DIR/../../.."
 
-ERROR=0
-
-
-for Dockerfile in $(find "$REPO_DIR/hadoop-ozone" "$REPO_DIR/hadoop-hdds" 
-name Dockerfile | sort); do
-  echo "Checking $Dockerfile"
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/hadolint"}
+mkdir -p "$REPORT_DIR"
+REPORT_FILE="$REPORT_DIR/summary.txt"

Review comment:
       To make sure `hadolint.sh` can be run multiple times and still give 
correct results, rather than keep accumulating findings:
   
   ```suggestion
   REPORT_FILE="$REPORT_DIR/summary.txt"
   echo -n > "$REPORT_FILE"
   ```

##########
File path: hadoop-ozone/dev-support/checks/hadolint.sh
##########
@@ -17,25 +17,24 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 
2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 REPO_DIR="$DIR/../../.."
 
-ERROR=0
-
-
-for Dockerfile in $(find "$REPO_DIR/hadoop-ozone" "$REPO_DIR/hadoop-hdds" 
-name Dockerfile | sort); do
-  echo "Checking $Dockerfile"
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/hadolint"}
+mkdir -p "$REPORT_DIR"
+REPORT_FILE="$REPORT_DIR/summary.txt"
 
+for Dockerfile in $(find hadoop-ozone hadoop-hdds -name Dockerfile | sort); do
   result=$( hadolint $Dockerfile )
   if [ ! -z "$result" ]
   then
-    echo "$result"
-    echo ""
-    ERROR=1
+    echo "$result" | tee -a "$REPORT_FILE"
   fi

Review comment:
       Loop body can be simplified to:
   
   ```
     hadolint $Dockerfile | tee -a "$REPORT_FILE"
   ```
   
   since we no longer need to set `ERROR` at the same time.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to