You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/13 08:13:17 UTC
(maven) branch maven-4.0.x updated: Key the Mimir cache on the POMs instead of the run
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-4.0.x by this push:
new 8a70357f97 Key the Mimir cache on the POMs instead of the run
8a70357f97 is described below
commit 8a70357f97c4469285ef65c3575917ed51ee656a
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Oct 13 08:46:37 2026 +0200
Key the Mimir cache on the POMs instead of the run
A run-id key saved about 0.5 GB per OS on every push that no later run could match; the POM hash saves a new entry only when the POMs change, and restore still falls back to the newest one.
---
.github/workflows/maven.yml | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 8c27e23d39..bb09241dce 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -47,6 +47,8 @@ env:
jobs:
initial-build:
runs-on: ubuntu-latest
+ outputs:
+ pom-hash: ${{ steps.pom-hash.outputs.hash }}
steps:
- name: Set up JDK
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
@@ -59,6 +61,11 @@ jobs:
with:
persist-credentials: false
+ - name: Hash the POMs for the Mimir cache key
+ id: pom-hash
+ shell: bash
+ run: echo "hash=${{ hashFiles('**/pom.xml') }}" >> "$GITHUB_OUTPUT"
+
- name: Prepare Mimir for Maven 3.x
shell: bash
run: |
@@ -71,7 +78,7 @@ jobs:
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.MIMIR_LOCAL }}
- key: mvn40-${{ runner.os }}-${{ github.run_id }}
+ key: mvn40-${{ runner.os }}-${{ steps.pom-hash.outputs.hash }}
restore-keys: |
mvn40-${{ runner.os }}-
mvn40-
@@ -179,7 +186,7 @@ jobs:
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.MIMIR_LOCAL }}
- key: mvn40-${{ runner.os }}-${{ github.run_id }}
+ key: mvn40-${{ runner.os }}-${{ needs.initial-build.outputs.pom-hash }}
restore-keys: |
mvn40-${{ runner.os }}-
mvn40-
@@ -283,7 +290,7 @@ jobs:
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.MIMIR_LOCAL }}
- key: mvn40-${{ runner.os }}-${{ github.run_id }}
+ key: mvn40-${{ runner.os }}-${{ needs.initial-build.outputs.pom-hash }}
restore-keys: |
mvn40-${{ runner.os }}-
mvn40-
@@ -333,10 +340,21 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
needs:
+ - initial-build
- full-build
- integration-tests
steps:
+ # The key changes only with the POMs; an entry saved under it is never replaced,
+ # so a run whose POMs match a stored entry has nothing to publish.
+ - name: Look up the cache
+ id: lookup
+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+ with:
+ path: ${{ env.MIMIR_LOCAL }}
+ key: mvn40-${{ runner.os }}-${{ needs.initial-build.outputs.pom-hash }}
+ lookup-only: true
- name: Download Caches
+ if: steps.lookup.outputs.cache-hit != 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
merge-multiple: true
@@ -344,7 +362,7 @@ jobs:
path: ${{ env.MIMIR_LOCAL }}
- name: Publish cache
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
- if: ${{ github.event_name != 'pull_request' && !cancelled() && !failure() }}
+ if: ${{ github.event_name != 'pull_request' && steps.lookup.outputs.cache-hit != 'true' && !cancelled() && !failure() }}
with:
path: ${{ env.MIMIR_LOCAL }}
- key: mvn40-${{ runner.os }}-${{ github.run_id }}
+ key: mvn40-${{ runner.os }}-${{ needs.initial-build.outputs.pom-hash }}