This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 01c29d9bbc8 Internalize Maven cache prefix in setup-build-environment 
(#40111)
01c29d9bbc8 is described below

commit 01c29d9bbc89b34a23f909b7f1dd630c1fb78426
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Oct 9 15:48:51 2026 +0800

    Internalize Maven cache prefix in setup-build-environment (#40111)
---
 .github/actions/setup-build-environment/action.yml | 25 ++++++++++------------
 .github/workflows/nightly-build.yml                | 11 ----------
 .github/workflows/nightly-check.yml                |  8 -------
 .github/workflows/nightly-ci.yml                   |  1 -
 .github/workflows/nightly-sql-parser.yml           |  2 --
 .github/workflows/release-mcp.yml                  |  1 -
 .github/workflows/reusable-global-environment.yml  |  4 ----
 .github/workflows/schedule-report.yml              |  4 ----
 8 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/.github/actions/setup-build-environment/action.yml 
b/.github/actions/setup-build-environment/action.yml
index 6bdfa6f9f74..3d5aba627d2 100644
--- a/.github/actions/setup-build-environment/action.yml
+++ b/.github/actions/setup-build-environment/action.yml
@@ -31,7 +31,7 @@ description: |
         cache-suffix: 'e2e-sql'
 
   Cache key format: {cache-prefix}-maven-{cache-suffix}-{pom.xml hash}
-  Default cache-prefix: 'apache-shardingsphere'
+  Cache prefix: workflow repository owner/name with '/' replaced by '-'.
   Default cache-suffix: 'full'
 
 inputs:
@@ -43,13 +43,6 @@ inputs:
     description: 'Java distribution (default: temurin)'
     required: false
     default: 'temurin'
-  cache-prefix:
-    description: |
-      Cache key prefix for multi-project isolation.
-      Used to separate caches between different projects or forks.
-      Default: 'apache-shardingsphere'
-    required: false
-    default: 'apache-shardingsphere'
   cache-suffix:
     description: |
       Cache key suffix for build scope optimization.
@@ -119,6 +112,10 @@ runs:
           exit 1
         fi
         echo "E2E_MAVEN_REPOSITORY=$repository" >> "$GITHUB_ENV"
+    - name: Set Maven Cache Prefix
+      id: cache-prefix
+      shell: bash
+      run: echo "value=${GITHUB_REPOSITORY//\//-}" >> "$GITHUB_OUTPUT"
     - name: Restore Maven Cache
       id: restore-maven-cache
       uses: actions/cache/[email protected]
@@ -127,12 +124,12 @@ runs:
           ${{ inputs.maven-repository-dir || '~/.m2/repository' }}
           !${{ inputs.maven-repository-dir || '~/.m2/repository' 
}}/org/apache/shardingsphere
           ${{ inputs.maven-repository-dir || '~/.m2/repository' 
}}/org/apache/shardingsphere/elasticjob
-        key: ${{ inputs.cache-prefix }}-maven-${{ inputs.cache-suffix }}-${{ 
hashFiles('**/pom.xml') }}
+        key: ${{ steps.cache-prefix.outputs.value }}-maven-${{ 
inputs.cache-suffix }}-${{ hashFiles('**/pom.xml') }}
         restore-keys: |
-          ${{ inputs.cache-prefix }}-maven-${{ inputs.cache-suffix }}-
-          ${{ inputs.cache-prefix }}-maven-full-
-          ${{ inputs.cache-prefix }}-maven-
-          ${{ inputs.cache-prefix }}-
+          ${{ steps.cache-prefix.outputs.value }}-maven-${{ 
inputs.cache-suffix }}-
+          ${{ steps.cache-prefix.outputs.value }}-maven-full-
+          ${{ steps.cache-prefix.outputs.value }}-maven-
+          ${{ steps.cache-prefix.outputs.value }}-
     - name: Remove Previous E2E Maven Artifacts
       if: inputs.maven-repository-dir != ''
       shell: bash
@@ -160,4 +157,4 @@ runs:
           ${{ inputs.maven-repository-dir || '~/.m2/repository' }}
           !${{ inputs.maven-repository-dir || '~/.m2/repository' 
}}/org/apache/shardingsphere
           ${{ inputs.maven-repository-dir || '~/.m2/repository' 
}}/org/apache/shardingsphere/elasticjob
-        key: ${{ inputs.cache-prefix }}-maven-${{ inputs.cache-suffix }}-${{ 
hashFiles('**/pom.xml') }}
+        key: ${{ steps.cache-prefix.outputs.value }}-maven-${{ 
inputs.cache-suffix }}-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/nightly-build.yml 
b/.github/workflows/nightly-build.yml
index 033f1254165..ecea5e364c1 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -55,8 +55,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Build Project
         run: |
           ./mvnw -B clean install -Prelease,default-dep
@@ -82,8 +80,6 @@ jobs:
         with:
           ref: ${{ inputs.commit-id }}
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Login Container Registry
         uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # 
v4.6.0
         with:
@@ -112,8 +108,6 @@ jobs:
         with:
           ref: ${{ inputs.commit-id }}
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # 
v4.6.0
         with:
           registry: ${{ env.HUB }}
@@ -145,8 +139,6 @@ jobs:
         with:
           ref: ${{ inputs.commit-id }}
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # 
v4.6.0
         with:
           registry: ${{ env.HUB }}
@@ -165,8 +157,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Build with Maven
         run: ./mvnw clean install -B -ntp -T1C -DskipTests
 
@@ -220,7 +210,6 @@ jobs:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
         with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
           enable-docker-setup: 'true'
       - name: Build with Maven
         run: ./mvnw -B -T1C -ntp clean install -DskipITs -DskipTests
diff --git a/.github/workflows/nightly-check.yml 
b/.github/workflows/nightly-check.yml
index bb4d58253b5..89294c8b827 100644
--- a/.github/workflows/nightly-check.yml
+++ b/.github/workflows/nightly-check.yml
@@ -46,8 +46,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Run SpotBugs
         run: ./mvnw clean install spotbugs:check -Pcheck -T1C
 
@@ -94,8 +92,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Initialize CodeQL
         uses: github/codeql-action/init@v3
         with:
@@ -141,8 +137,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Run Dependency Convergence Check
         run: |
           sed -i '/<requireMavenVersion>/i \                                   
 <dependencyConvergence/>' pom.xml
@@ -157,8 +151,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Run OWASP Check
         # https://nvd.nist.gov/developers/request-an-api-key
         run: ./mvnw clean dependency-check:aggregate -DnvdApiKey=${{ 
secrets.NIST_NVD_API_KEY }}
diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml
index 22fcb68c1bd..34c251296db 100644
--- a/.github/workflows/nightly-ci.yml
+++ b/.github/workflows/nightly-ci.yml
@@ -57,7 +57,6 @@ jobs:
       - uses: ./.github/actions/setup-build-environment
         with:
           java-version: ${{ matrix.java-version }}
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Build Project with Maven
         run: ./mvnw clean install -B -ntp -T1C
       - name: Build Examples with Maven
diff --git a/.github/workflows/nightly-sql-parser.yml 
b/.github/workflows/nightly-sql-parser.yml
index 8d756687f25..8083128a7fd 100644
--- a/.github/workflows/nightly-sql-parser.yml
+++ b/.github/workflows/nightly-sql-parser.yml
@@ -56,8 +56,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Build Project with Maven
         run: ./mvnw -T1C -B -ntp clean install
       - name: Clear Previous SQL Parser XML
diff --git a/.github/workflows/release-mcp.yml 
b/.github/workflows/release-mcp.yml
index cb4344809ec..d6fbc7af36b 100644
--- a/.github/workflows/release-mcp.yml
+++ b/.github/workflows/release-mcp.yml
@@ -62,7 +62,6 @@ jobs:
       - uses: ./.github/actions/setup-build-environment
         with:
           java-version: '21'
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
           cache-suffix: 'release-mcp'
           enable-docker-setup: 'true'
       - name: Resolve Release Version
diff --git a/.github/workflows/reusable-global-environment.yml 
b/.github/workflows/reusable-global-environment.yml
index 3af71a9b1e1..3877fbcc5ad 100644
--- a/.github/workflows/reusable-global-environment.yml
+++ b/.github/workflows/reusable-global-environment.yml
@@ -18,8 +18,6 @@
 on:
   workflow_call:
     outputs:
-      GLOBAL_CACHE_PREFIX:
-        value: ${{ jobs.init-environment.outputs.GLOBAL_CACHE_PREFIX }}
       GLOBAL_RUNS_ON:
         value: ${{ jobs.init-environment.outputs.GLOBAL_RUNS_ON }}
       GLOBAL_JOB_ENABLED:
@@ -38,11 +36,9 @@ jobs:
         env:
           GLOBAL_REPOSITORY: ${{ vars.GLOBAL_REPOSITORY || 
'apache/shardingsphere' }}
         run: |
-          echo "GLOBAL_CACHE_PREFIX=${GLOBAL_REPOSITORY//\//-}" >> 
"$GITHUB_OUTPUT"
           if [ "$GITHUB_REPOSITORY" = "$GLOBAL_REPOSITORY" ]; then
             echo "GLOBAL_JOB_ENABLED=true" >> "$GITHUB_OUTPUT"
           fi
     outputs:
       GLOBAL_RUNS_ON: ${{ vars.GLOBAL_RUNS_ON || 'ubuntu-latest' }}
       GLOBAL_JOB_ENABLED: ${{ 
steps.global-environment.outputs.GLOBAL_JOB_ENABLED }}
-      GLOBAL_CACHE_PREFIX: ${{ 
steps.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
diff --git a/.github/workflows/schedule-report.yml 
b/.github/workflows/schedule-report.yml
index 755d2626702..fe21de0b8e4 100644
--- a/.github/workflows/schedule-report.yml
+++ b/.github/workflows/schedule-report.yml
@@ -46,8 +46,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Install Project
         run: ./mvnw clean install -DskipTests -T1C
       - name: Build with maven and execute jacoco aggregation script
@@ -76,8 +74,6 @@ jobs:
     steps:
       - uses: actions/[email protected]
       - uses: ./.github/actions/setup-build-environment
-        with:
-          cache-prefix: ${{ 
needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - uses: actions/[email protected]
         with:
           path: ~/.sonar/cache

Reply via email to