adoroszlai commented on code in PR #5267:
URL: https://github.com/apache/ozone/pull/5267#discussion_r1328131318


##########
dev-support/ci/selective_basic_ci_checks.sh:
##########


Review Comment:
   The other script is named `selective_ci_checks.sh` because it decides which 
checks to run.  This one does not filter the checks, rather categorizes them.  
So I think a better name for this script and the corresponding CI step would be 
something like `categorize_basic_checks.sh` and `categorize-basic-checks`, 
respectively.



##########
.github/workflows/ci.yml:
##########
@@ -62,6 +64,31 @@ jobs:
       - name: Acceptance suites
         id: acceptance-suites
         run: dev-support/ci/acceptance_suites.sh
+  pre-checks:
+    needs:
+      - build-info
+    runs-on: ubuntu-20.04
+    timeout-minutes: 45
+    outputs:
+      basic-checks: ${{ steps.selective-basic-checks.outputs.basic-checks }}
+      basic-unit: ${{ steps.selective-basic-checks.outputs.basic-unit }}
+    steps:
+      - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+        uses: actions/checkout@v3
+        with:
+          persist-credentials: false
+      - name: Fetch incoming commit ${{ github.sha }} with its parent
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ github.sha }}
+          fetch-depth: 2
+          persist-credentials: false
+        if: github.event_name  == 'pull_request'
+      - name: Selective Basic Checks
+        id: selective-basic-checks
+        env:
+          ALL_BASIC_CHECKS: "${{ needs.build-info.outputs.all-basic-checks }}"
+        run: dev-support/ci/selective_basic_ci_checks.sh

Review Comment:
   This step (and its two outputs) can be added as the last step in 
`build-info`, no need for a separate job.  The step's input needs to be tweaked 
a bit to `${{ steps.selective-checks.outputs.basic-checks }}`.



##########
dev-support/ci/selective_ci_checks.sh:
##########
@@ -82,7 +82,9 @@ function get_changed_files() {
 }
 
 function set_outputs_run_everything_and_exit() {
-    BASIC_CHECKS="author bats checkstyle docs findbugs native rat unit"
+    BASIC_CHECKS=$(grep -r '^#checks:' hadoop-ozone/dev-support/checks \
+                   | sort -u | cut -f1 -d':' | rev | cut -f1 -d'/' | rev \
+                   | cut -f1 -d'.')

Review Comment:
   Can be simplified a bit:
   
   * `grep -l` only prints paths with match(es), so we can omit the first `cut`
   * `basename` extracts the filename out of a path
   * `xargs` helps apply a command to each item from stdin
   
   ```suggestion
       BASIC_CHECKS=$(grep -lr '^#checks:' hadoop-ozone/dev-support/checks \
                      | sort -u | xargs -n1 basename \
                      | cut -f1 -d'.')
   ```
   
   The same applies to similar commands in `selective_basic_ci_checks.sh`.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to