You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/04/15 01:45:44 UTC

[PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Aias00 opened a new pull request, #6326:
URL: https://github.com/apache/shenyu/pull/6326

   ## Summary
   - add workflow-level concurrency cancellation for heavy PR workflows
   - deduplicate `e2e` image preparation into a single upstream job
   - deduplicate `it-k8s` image preparation and remove repeated setup/cache steps
   
   ## Testing
   - `python3` YAML parse for modified workflows
   - `actionlint` on modified workflows with repo-specific false-positive filters
   - `git diff --check`
   


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 closed pull request #6326: Optimize PR CI by deduplicating heavy workflow setup
URL: https://github.com/apache/shenyu/pull/6326


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
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/kind@v0.14.0
-          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/kind@v0.14.0
-          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/kind@v0.14.0
-          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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 commented on PR #6326:
URL: https://github.com/apache/shenyu/pull/6326#issuecomment-5738055576

   Note (PMC Aias00): this PR currently has merge conflicts (CONFLICTING) and cannot be merged. Please rebase onto the latest master and resolve the conflicts, then request a re-review. (Leaving a comment rather than requesting changes since this is my own PR.)


-- 
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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6326:
URL: https://github.com/apache/shenyu/pull/6326#discussion_r3083475889


##########
.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/kind@v0.14.0
-          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:
   This `Build examples` step runs `clean install` with `-am`, which will trigger additional cleaning/rebuilding of dependencies and increases runtime. Prefer running without `clean` (or merging with the prior Maven invocation) so the example image build can reuse already-built artifacts.



##########
.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/kind@v0.14.0
-          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:
   `prepare-images` runs three separate Maven builds, each starting with `clean`, which forces redundant recompilation and reduces the CI savings from deduplicating this workflow. Consider removing the initial full `clean install` here and/or consolidating the needed modules/profiles into a single build so dependencies are built once (e.g., avoid multiple `clean` invocations).



##########
.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/kind@v0.14.0
-          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:
   The follow-up `Build integrated tests` step also uses `clean install` (with `-am`), which will clean and rebuild upstream modules again even though they were already built earlier in this job. Dropping `clean` (or combining builds) would avoid extra work and speed up `prepare-images`.



##########
.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:
   This job still uses `actions/checkout@v2` while other jobs in this workflow use `@v3`. `checkout@v2` is deprecated (Node 12-based) and may start failing as GitHub retires older runtimes; update this to match the newer version used elsewhere (e.g., `actions/checkout@v3` or `@v4`).
   ```suggestion
         - uses: actions/checkout@v3
   ```



##########
.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:
   `Build examples with Maven` uses `clean install` after the main `-Prelease,docker` build, which will unnecessarily clean/rebuild any `-am` dependencies and can significantly increase CI time. Consider removing `clean` here so this step can reuse artifacts from the previous build (or combine the builds if feasible).
   ```suggestion
               mvnd -B 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 install -Pexample -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -am -f ./shenyu-examples/pom.xml
   ```



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "moremind (via GitHub)" <gi...@apache.org>.
moremind commented on code in PR #6326:
URL: https://github.com/apache/shenyu/pull/6326#discussion_r3098804686


##########
.github/workflows/e2e-k8s.yml:
##########
@@ -27,18 +31,10 @@ jobs:
     outputs:
       e2e: ${{ steps.filter.outputs.e2e }}
     steps:
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           submodules: true
-      - name: Free disk space
-        run: |

Review Comment:
   remove the command may cause out of disk 



-- 
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: notifications-unsubscribe@shenyu.apache.org

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


Re: [PR] Optimize PR CI by deduplicating heavy workflow setup [shenyu]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 commented on PR #6326:
URL: https://github.com/apache/shenyu/pull/6326#issuecomment-5953282183

   Thank you for the contribution. The current CI setup is comprehensive and meets the project's present needs. We do not need further CI adjustments at this time, so this PR is being closed for now.


-- 
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: notifications-unsubscribe@shenyu.apache.org

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