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

snuyanzin pushed a commit to branch release-2.2
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-2.2 by this push:
     new 574e82351fe [FLINK-39595][ci] Use GHA cache per branch
574e82351fe is described below

commit 574e82351fece01f76f03f00962bc8bc81869d6b
Author: Sergey Nuyanzin <[email protected]>
AuthorDate: Mon May 4 15:43:10 2026 +0200

    [FLINK-39595][ci] Use GHA cache per branch
---
 .github/actions/job_init/action.yml     | 28 ++++++++++++++++++++++++++--
 .github/workflows/template.flink-ci.yml |  4 ++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/.github/actions/job_init/action.yml 
b/.github/actions/job_init/action.yml
index 561b23ffeb0..260e4c8680b 100644
--- a/.github/actions/job_init/action.yml
+++ b/.github/actions/job_init/action.yml
@@ -74,13 +74,37 @@ runs:
         echo "JAVA_HOME=$JAVA_HOME_${{ inputs.jdk_version }}_X64" >> 
"${GITHUB_ENV}"
         echo "PATH=$JAVA_HOME_${{ inputs.jdk_version }}_X64/bin:$PATH" >> 
"${GITHUB_ENV}"
 
+    - name: "Determine cache namespace (PR base | branch | tag)"
+      id: cache-ns
+      shell: bash
+      run: |
+        # For PR runs use the target branch so PRs share a cache pool with the 
branch they merge into.
+        # For push / workflow_dispatch / tag pushes, use the ref name itself.
+        if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ 
github.event_name }}" = "pull_request_target" ]; then
+          ns="${{ github.base_ref }}"
+        else
+          ns="${{ github.ref_name }}"
+        fi
+        # Map release tags (release-X.Y.Z, release-X.Y.Z-rcN) back to their 
parent branch
+        # (release-X.Y) so tag builds reuse the branch's warm cache.
+        case "${ns}" in
+          release-[0-9]*.[0-9]*.[0-9]*) ns="$(printf '%s' "${ns}" | sed 
's/^\(release-[0-9][0-9]*\.[0-9][0-9]*\)\..*/\1/')" ;;
+        esac
+        # Sanitize for use in a cache key (no slashes, spaces, etc.).
+        ns="$(printf '%s' "${ns}" | tr -c '[:alnum:]._-' '-')"
+        echo "namespace=${ns}" >> "${GITHUB_OUTPUT}"
+        echo "Cache namespace: ${ns}"
+
     - name: "Setup Maven package cache"
       if: ${{ inputs.maven_repo_folder != '' }}
       uses: actions/cache@v4
       with:
         path: ${{ inputs.maven_repo_folder }}
-        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-        restore-keys: ${{ runner.os }}-maven
+        key: ${{ runner.os }}-ns-${{ steps.cache-ns.outputs.namespace 
}}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
+        restore-keys: |
+          ${{ runner.os }}-ns-${{ steps.cache-ns.outputs.namespace 
}}-maven-${{ hashFiles('**/pom.xml') }}-
+          ${{ runner.os }}-ns-${{ steps.cache-ns.outputs.namespace }}-maven-
+          ${{ runner.os }}-maven-
 
     - name: "Moves checkout content from ${{ inputs.source_directory }} to ${{ 
inputs.target_directory }}."
       if: ${{ inputs.source_directory != '' && inputs.target_directory != '' }}
diff --git a/.github/workflows/template.flink-ci.yml 
b/.github/workflows/template.flink-ci.yml
index e8970f664a8..08af1e340a6 100644
--- a/.github/workflows/template.flink-ci.yml
+++ b/.github/workflows/template.flink-ci.yml
@@ -106,7 +106,7 @@ jobs:
         timeout-minutes: ${{ fromJSON(env.GHA_JOB_TIMEOUT) }}
         with:
           working_directory: ${{ env.CONTAINER_LOCAL_WORKING_DIR }}
-          maven-parameters: "test-compile -Dflink.markBundledAsOptional=false 
-Dfast"
+          maven-parameters: "-T 1C test-compile 
-Dflink.markBundledAsOptional=false -Dfast"
           env: "${{ inputs.environment }}"
 
       - name: "Collect build artifacts"
@@ -405,7 +405,7 @@ jobs:
       - name: "Build Flink"
         uses: "./.github/actions/run_mvn"
         with:
-          maven-parameters: "install -DskipTests -Dfast $PROFILE 
-Pskip-webui-build"
+          maven-parameters: "install -DskipTests -Dfast $PROFILE 
-Pskip-webui-build -T1C"
           env: "${{ inputs.environment }}"
 
       - name: "Run E2E Tests"

Reply via email to