Aias00 commented on code in PR #6326:
URL: https://github.com/apache/shenyu/pull/6326#discussion_r3083536604


##########
.github/workflows/e2e-k8s.yml:
##########
@@ -112,48 +109,66 @@ jobs:
             mvnd -B clean install -Prelease,docker -Dmaven.javadoc.skip=true 
-B -Drat.skip=true -Dmaven.test.skip=true -Djacoco.skip=true -DskipITs 
-DskipTests package -T1C
           else
             echo "Falling back to maven wrapper"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Prelease,docker 
-Dmaven.javadoc.skip=true -B -Drat.skip=true -Dmaven.test.skip=true 
-Djacoco.skip=true -DskipITs -DskipTests package -T1C
-            else
-              ./mvnw -B clean install -Prelease,docker 
-Dmaven.javadoc.skip=true -B -Drat.skip=true -Dmaven.test.skip=true 
-Djacoco.skip=true -DskipITs -DskipTests package -T1C
-            fi
+            ./mvnw -B clean install -Prelease,docker -Dmaven.javadoc.skip=true 
-B -Drat.skip=true -Dmaven.test.skip=true -Djacoco.skip=true -DskipITs 
-DskipTests package -T1C
+          fi
+
+      - name: Build examples with Maven
+        shell: bash
+        run: |
+          if mvnd --version > /dev/null 2>&1; then
+            echo "Using mvnd for build examples"
+            mvnd -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
+          else
+            echo "Falling back to maven wrapper for examples"
+            ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml

Review Comment:
   Changed the follow-up example build from `clean install` to `install` so it 
can reuse artifacts produced by the earlier build in the same job.



##########
.github/workflows/e2e-k8s.yml:
##########
@@ -261,7 +254,6 @@ jobs:
             script: e2e-logging-rocketmq-compose
           # - case: shenyu-e2e-case-logging-kafka
           #   script: e2e-logging-kafka-compose
-
     steps:
       - uses: actions/checkout@v2

Review Comment:
   Updated the `e2e-k8s.yml` checkout steps to `actions/checkout@v4` so this 
workflow no longer relies on the deprecated v2 action.



##########
.github/workflows/integrated-test-k8s-ingress.yml:
##########
@@ -60,155 +56,201 @@ jobs:
               - '!.github/ISSUE_TEMPLATE/**'
               - '!.github/PULL_REQUEST_TEMPLATE'
 
+  prepare-images:
+    needs: changes
+    if: github.repository == 'apache/shenyu' && 
needs.changes.outputs.k8s-ingress == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+
       - name: Clean Space
-        if: steps.filter.outputs.k8s-ingress == 'true'
         run: |
           sudo rm -rf /usr/share/dotnet
           sudo rm -rf /opt/ghc
           sudo rm -rf "/usr/local/share/boost"
           sudo rm -rf "$AGENT_TOOLSDIRECTORY"
 
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        with:
-          java-version: 17
-          distribution: "temurin"
-
-      - name: Install Go
-        uses: actions/setup-go@v3
-        with:
-          go-version: 1.17.x
-
-      - name: Install k8s
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        run: |
-          go install sigs.k8s.io/[email protected]
-          curl -LO 
https://storage.googleapis.com/kubernetes-release/release/v1.24.14/bin/linux/amd64/kubectl
 && sudo install kubectl /usr/local/bin/kubectl
-          kind create cluster --image=kindest/node:v1.21.1 
--config=./shenyu-integrated-test/${{ matrix.case }}/deploy/kind-config.yaml
-
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
+      - name: Restore Maven Repos
+        id: restore-maven-cache
+        uses: actions/cache/restore@v3
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
 
       - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
         with:
           java-version: 17
           distribution: "temurin"
 
       - name: Install mvnd
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           MVND_VERSION=1.0.2
-          if [[ "${{ runner.os }}" == "Windows" ]]; then
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-windows-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-windows-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          else
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          fi
+          curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
+          unzip -q mvnd.zip
+          mkdir -p $HOME/.local
+          mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
+          echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
+          echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
 
       - name: Build with Maven
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build"
             mvnd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           else
             echo "Falling back to maven wrapper"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            else
-              ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            fi
+            ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           fi
 
       - name: Build integrated tests
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build integrated tests"
             mvnd -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
           else
             echo "Falling back to maven wrapper for integrated tests"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
-            else
-              ./mvnw -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
-            fi
+            ./mvnw -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
           fi

Review Comment:
   Updated this step to `install` so it reuses artifacts from the earlier 
prepare build instead of cleaning and recompiling upstream modules again.



##########
.github/workflows/integrated-test-k8s-ingress.yml:
##########
@@ -60,155 +56,201 @@ jobs:
               - '!.github/ISSUE_TEMPLATE/**'
               - '!.github/PULL_REQUEST_TEMPLATE'
 
+  prepare-images:
+    needs: changes
+    if: github.repository == 'apache/shenyu' && 
needs.changes.outputs.k8s-ingress == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+
       - name: Clean Space
-        if: steps.filter.outputs.k8s-ingress == 'true'
         run: |
           sudo rm -rf /usr/share/dotnet
           sudo rm -rf /opt/ghc
           sudo rm -rf "/usr/local/share/boost"
           sudo rm -rf "$AGENT_TOOLSDIRECTORY"
 
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        with:
-          java-version: 17
-          distribution: "temurin"
-
-      - name: Install Go
-        uses: actions/setup-go@v3
-        with:
-          go-version: 1.17.x
-
-      - name: Install k8s
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        run: |
-          go install sigs.k8s.io/[email protected]
-          curl -LO 
https://storage.googleapis.com/kubernetes-release/release/v1.24.14/bin/linux/amd64/kubectl
 && sudo install kubectl /usr/local/bin/kubectl
-          kind create cluster --image=kindest/node:v1.21.1 
--config=./shenyu-integrated-test/${{ matrix.case }}/deploy/kind-config.yaml
-
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
+      - name: Restore Maven Repos
+        id: restore-maven-cache
+        uses: actions/cache/restore@v3
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
 
       - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
         with:
           java-version: 17
           distribution: "temurin"
 
       - name: Install mvnd
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           MVND_VERSION=1.0.2
-          if [[ "${{ runner.os }}" == "Windows" ]]; then
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-windows-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-windows-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          else
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          fi
+          curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
+          unzip -q mvnd.zip
+          mkdir -p $HOME/.local
+          mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
+          echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
+          echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
 
       - name: Build with Maven
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build"
             mvnd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           else
             echo "Falling back to maven wrapper"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            else
-              ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            fi
+            ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           fi

Review Comment:
   Dropped `clean` from the prepare-stage Maven commands so later invocations 
can reuse outputs from earlier phases instead of rebuilding from scratch.



##########
.github/workflows/integrated-test-k8s-ingress.yml:
##########
@@ -60,155 +56,201 @@ jobs:
               - '!.github/ISSUE_TEMPLATE/**'
               - '!.github/PULL_REQUEST_TEMPLATE'
 
+  prepare-images:
+    needs: changes
+    if: github.repository == 'apache/shenyu' && 
needs.changes.outputs.k8s-ingress == 'true'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+
       - name: Clean Space
-        if: steps.filter.outputs.k8s-ingress == 'true'
         run: |
           sudo rm -rf /usr/share/dotnet
           sudo rm -rf /opt/ghc
           sudo rm -rf "/usr/local/share/boost"
           sudo rm -rf "$AGENT_TOOLSDIRECTORY"
 
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-
-      - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        with:
-          java-version: 17
-          distribution: "temurin"
-
-      - name: Install Go
-        uses: actions/setup-go@v3
-        with:
-          go-version: 1.17.x
-
-      - name: Install k8s
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        run: |
-          go install sigs.k8s.io/[email protected]
-          curl -LO 
https://storage.googleapis.com/kubernetes-release/release/v1.24.14/bin/linux/amd64/kubectl
 && sudo install kubectl /usr/local/bin/kubectl
-          kind create cluster --image=kindest/node:v1.21.1 
--config=./shenyu-integrated-test/${{ matrix.case }}/deploy/kind-config.yaml
-
-      - name: Cache Maven Repos
-        if: steps.filter.outputs.k8s-ingress == 'true'
-        uses: actions/cache@v3
+      - name: Restore Maven Repos
+        id: restore-maven-cache
+        uses: actions/cache/restore@v3
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
 
       - uses: actions/setup-java@v4
-        if: steps.filter.outputs.k8s-ingress == 'true'
         with:
           java-version: 17
           distribution: "temurin"
 
       - name: Install mvnd
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           MVND_VERSION=1.0.2
-          if [[ "${{ runner.os }}" == "Windows" ]]; then
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-windows-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-windows-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          else
-            curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
-            unzip -q mvnd.zip
-            mkdir -p $HOME/.local
-            mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
-            echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
-            echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
-          fi
+          curl -sL 
https://downloads.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip
 -o mvnd.zip
+          unzip -q mvnd.zip
+          mkdir -p $HOME/.local
+          mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
+          echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
+          echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
 
       - name: Build with Maven
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build"
             mvnd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           else
             echo "Falling back to maven wrapper"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            else
-              ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
-            fi
+            ./mvnw -B clean install -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true
           fi
 
       - name: Build integrated tests
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build integrated tests"
             mvnd -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
           else
             echo "Falling back to maven wrapper for integrated tests"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
-            else
-              ./mvnw -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
-            fi
+            ./mvnw -B clean install -Pit -DskipTests -am -f 
./shenyu-integrated-test/pom.xml
           fi
 
       - name: Build examples
-        if: steps.filter.outputs.k8s-ingress == 'true'
         shell: bash
         run: |
           if mvnd --version > /dev/null 2>&1; then
             echo "Using mvnd for build examples"
             mvnd -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
           else
             echo "Falling back to maven wrapper for examples"
-            if [[ "${{ runner.os }}" == "Windows" ]]; then
-              ./mvnw.cmd -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
-            else
-              ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
-            fi
+            ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
           fi

Review Comment:
   Updated this step to `install` as well. The example-image build now reuses 
outputs from the previous steps instead of wiping the workspace with another 
`clean`.



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

Reply via email to