chihsuan commented on code in PR #11946: URL: https://github.com/apache/ozone/pull/11946#discussion_r4488409560
########## .github/actions/check/action.yaml: ########## @@ -0,0 +1,190 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Executes a single check from `hadoop-ozone/dev-support/checks/`. +# Before and after the check, it performs various steps based on inputs. + +name: check + +inputs: + # REQUIRED + script: + required: true + description: "Test script to run from hadoop-ozone/dev-support/checks, without .sh extension" + + # OPTIONAL (ordered alphabetically) + checkout-fetch-depth: + description: "Fetch depth for checking out the repo (default: no history)" + default: 1 + + java-version: + description: "Java version to set up (default: none)" + default: '' + + needs-maven-cache: + description: "Whether to restore Maven cache before run (default: yes)" + default: true + + needs-npm-cache: + description: "Whether to restore NPM cache before run (default: no)" + default: false + + needs-ozone-binary-tarball: + description: "Whether to download Ozone binary tarball created by build (default: no)" + default: false + + needs-ozone-repo: + description: "Whether to download Ozone jars created by build (default: no)" + default: false + + needs-ozone-source-tarball: + description: "Whether to download Ozone source tarball created by build (default: no)" + default: false + + ratis-args: + description: "Version overrides from custom Ratis build (default: none)" + default: '' + + script-args: + description: "Arguments for the test script, ratis-args are appended" + default: '' + + split: + description: "Name of split for matrix jobs, only used in display name" + default: '' + +runs: + using: 'composite' + steps: + - name: Checkout project + if: ${{ inputs.needs-ozone-source-tarball != 'true' }} + uses: actions/checkout@v7 + with: + persist-credentials: false + ref: ${{ env.SHA }} + fetch-depth: ${{ inputs.checkout-fetch-depth }} + + - name: Delete .git to omit commit SHA in build artifacts + if: ${{ inputs.needs-ozone-source-tarball != 'true' && inputs.checkout-fetch-depth == '1' }} + shell: bash + run: | + rm -fr .git + + - name: Download Ozone source tarball + if: ${{ inputs.needs-ozone-source-tarball == 'true' }} + uses: actions/download-artifact@v8 + with: + name: ozone-src + + - name: Extract source tarball + if: ${{ inputs.needs-ozone-source-tarball == 'true' }} + shell: bash + run: | + tar --strip-components 1 -xzvf ozone*-src.tar.gz + + - name: Cache for NPM dependencies + if: ${{ inputs.needs-npm-cache == 'true' }} + uses: actions/cache@v6 + with: + path: | + ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: Cache for Maven dependencies + if: ${{ inputs.needs-maven-cache == 'true' }} + uses: actions/cache/restore@v6 + with: + path: | + ~/.m2/repository/*/*/* + !~/.m2/repository/org/apache/ozone + key: maven-repo-${{ hashFiles('**/pom.xml') }} + restore-keys: | + maven-repo- + + - name: Download Ozone repo + id: download-ozone-repo + if: ${{ inputs.needs-ozone-repo == 'true' }} + uses: actions/download-artifact@v8 + with: + name: ozone-repo + path: | + ~/.m2/repository/org/apache/ozone + + - name: Download Ratis repo + if: ${{ inputs.ratis-args != '' }} + uses: actions/download-artifact@v8 + with: + name: ratis-jars + path: | + ~/.m2/repository/org/apache/ratis + + - name: Download Ozone binary tarball + if: ${{ inputs.needs-ozone-binary-tarball == 'true' }} + uses: actions/download-artifact@v8 + with: + name: ozone-bin + + - name: Extract binary tarball + if: ${{ inputs.needs-ozone-binary-tarball == 'true' }} + shell: bash + run: | + mkdir -p hadoop-ozone/dist/target + tar xzvf ozone*.tar.gz -C hadoop-ozone/dist/target + rm ozone*.tar.gz + + - name: Setup java ${{ inputs.java-version }} + if: ${{ inputs.java-version != '' }} + uses: actions/setup-java@v6 + with: + distribution: 'temurin' + java-version: ${{ inputs.java-version }} + + - name: Execute tests + shell: bash + run: | + $COMMAND + env: + COMMAND: hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }} + + - name: Summary of failures + if: ${{ failure() }} + shell: bash + run: | + if [[ -s "target/$SCRIPT/summary.md" ]]; then + cat target/$SCRIPT/summary.md >> $GITHUB_STEP_SUMMARY + fi + hadoop-ozone/dev-support/checks/_summary.sh target/$SCRIPT/summary.txt + env: + SCRIPT: ${{ inputs.script }} + + - name: Archive build results + id: archive + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v7 + with: + name: ${{ (inputs.split && format('{0}-{1}', inputs.script, inputs.split)) || inputs.script }} Review Comment: I noticed in the CI run that `acceptance-ozone/test-s3a.sh` was actually failed because artifact name is not valid. It's green because of `continue-on-error`. Should we keep the name sanitizing from the old [Calculate artifact name](https://github.com/apache/ozone/blob/5c2069b9e05abfafd01d7c14c52dfad28eb9b03b/.github/workflows/check.yml#L312-L321) step? <img width="1511" height="863" alt="Image" src="https://github.com/user-attachments/assets/7ab36bf5-9e77-4da0-b0c5-81553697ea2a" /> ########## .github/workflows/ci.yml: ########## @@ -312,19 +353,20 @@ jobs: - dependency - license if: needs.build-info.outputs.needs-compose-tests == 'true' - uses: $/.github/workflows/check.yml - secrets: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - with: - java-version: 11 # Hadoop may not work with newer Java - needs-ozone-binary-tarball: true - ratis-args: ${{ inputs.ratis_args }} - script: acceptance - script-args: ${{ matrix.suite }} - sha: ${{ needs.build-info.outputs.sha }} - split: ${{ matrix.suite }} - timeout-minutes: 60 - with-coverage: ${{ fromJSON(needs.build-info.outputs.with-coverage) }} + runs-on: ubuntu-24.04 + timeout-minutes: 60 + steps: + - name: Run check + uses: $/.github/actions/check Review Comment: Should the Hadoop/Ranger cache restore move here? The old `check.yml` [steps](https://github.com/apache/ozone/blob/5c2069b9e05abfafd01d7c14c52dfad28eb9b03b/.github/workflows/check.yml#L246-L273) seem to be dropped. ########## .github/workflows/ci.yml: ########## @@ -185,36 +216,40 @@ jobs: - java: 21 os: macos-15 fail-fast: false - uses: $/.github/workflows/check.yml - with: - java-version: ${{ matrix.java }} - needs-ozone-source-tarball: true - ratis-args: ${{ inputs.ratis_args }} - runner: ${{ matrix.os }} - script: compile - script-args: "-Pdist -DskipRecon -Dmaven.javadoc.failOnWarnings -Dozone.java.version.server=${{ matrix.java }}" - sha: ${{ needs.build-info.outputs.sha }} - split: ${{ matrix.java }} - timeout-minutes: 45 - with-coverage: false - secrets: - DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + runs-on: ubuntu-24.04 + timeout-minutes: 45 + steps: + - name: Run check + uses: $/.github/actions/check + with: + java-version: ${{ matrix.java }} + needs-ozone-source-tarball: true + ratis-args: ${{ inputs.ratis_args }} + runner: ${{ matrix.os }} Review Comment: I wonder if `runs-on` should use `matrix.os` here? The action has no runner input. Currently, the [compile (21, macos-15)](https://github.com/adoroszlai/ozone/actions/runs/42025404878/job/127243121137) ran on ubuntu-24.04. <img width="1511" height="859" alt="Image" src="https://github.com/user-attachments/assets/e2b01655-4c28-4d2e-a820-54707db651ce" /> ########## dev-support/ci/selective_ci_checks.sh: ########## @@ -198,7 +198,7 @@ function check_if_tests_are_needed_at_all() { function run_all_tests_if_environment_files_changed() { start_end::group_start "Check if everything should be run" local pattern_array=( - "^.github/workflows/check.yml" + "^.github/actions/check/action.yml" Review Comment: Should this be action.y**a**ml? ```suggestion "^.github/actions/check/action.yaml" ``` ########## .github/actions/check/action.yaml: ########## @@ -0,0 +1,190 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Executes a single check from `hadoop-ozone/dev-support/checks/`. +# Before and after the check, it performs various steps based on inputs. + +name: check + +inputs: + # REQUIRED + script: + required: true + description: "Test script to run from hadoop-ozone/dev-support/checks, without .sh extension" + + # OPTIONAL (ordered alphabetically) + checkout-fetch-depth: + description: "Fetch depth for checking out the repo (default: no history)" + default: 1 + + java-version: + description: "Java version to set up (default: none)" + default: '' + + needs-maven-cache: + description: "Whether to restore Maven cache before run (default: yes)" + default: true + + needs-npm-cache: + description: "Whether to restore NPM cache before run (default: no)" + default: false + + needs-ozone-binary-tarball: + description: "Whether to download Ozone binary tarball created by build (default: no)" + default: false + + needs-ozone-repo: + description: "Whether to download Ozone jars created by build (default: no)" + default: false + + needs-ozone-source-tarball: + description: "Whether to download Ozone source tarball created by build (default: no)" + default: false + + ratis-args: + description: "Version overrides from custom Ratis build (default: none)" + default: '' + + script-args: + description: "Arguments for the test script, ratis-args are appended" + default: '' + + split: + description: "Name of split for matrix jobs, only used in display name" + default: '' + +runs: + using: 'composite' + steps: + - name: Checkout project + if: ${{ inputs.needs-ozone-source-tarball != 'true' }} + uses: actions/checkout@v7 + with: + persist-credentials: false + ref: ${{ env.SHA }} Review Comment: Should we set SHA from `needs.build-info.outputs.sha` somewhere? I couldn't find it defined. ########## .github/workflows/ci.yml: ########## Review Comment: nit: I think we can probably drop the `build-args`, `java-version` and `with-coverage` here since jobs now read env directly, so they and the comment above look unused. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
