Skip to content

Commit

Permalink
Don't save a cache per run id
Browse files Browse the repository at this point in the history
A daily cache is enough. Otherwise we will have a lot of entries.

(cherry picked from commit 7762ac5)
  • Loading branch information
gsmet committed Aug 20, 2024
1 parent 7c69200 commit 612cc37
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 26 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
gib_impacted: ${{ steps.get-gib-impacted.outputs.impacted_modules }}
m2-monthly-branch-cache-key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}
m2-monthly-cache-key: ${{ steps.cache-key.outputs.m2-monthly-cache-key }}
m2-cache-key: ${{ steps.cache-key.outputs.m2-cache-key }}
quarkus-metadata-cache-key: ${{ steps.cache-key.outputs.quarkus-metadata-cache-key }}
quarkus-metadata-cache-key-default: ${{ steps.cache-key.outputs.quarkus-metadata-cache-key-default }}
steps:
Expand All @@ -132,9 +133,11 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
CURRENT_WEEK=$(/bin/date -u "+%Y-%U")
echo "quarkus-metadata-cache-key=quarkus-metadata-cache-${CURRENT_WEEK}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "quarkus-metadata-cache-key-default=quarkus-metadata-cache-${CURRENT_WEEK}-${{ github.event.repository.default_branch }}" >> $GITHUB_OUTPUT
Expand All @@ -143,10 +146,10 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.m2/repository
# This will never work but it should fallback to the restore key below and get the latest cache for this branch.
# The cache is dropped monthly to prevent unlimited growth.
# The cache is per branch.
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
# The whole cache is dropped monthly to prevent unlimited growth.
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -375,7 +378,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -482,7 +485,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -584,7 +587,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -676,7 +679,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -772,7 +775,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -855,7 +858,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -939,7 +942,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -1023,7 +1026,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -1136,7 +1139,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven Repository
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven Repository
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/native-it-selected-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
outputs:
gib_args: ${{ steps.get-gib-args.outputs.gib_args }}
gib_impacted: ${{ steps.get-gib-impacted.outputs.impacted_modules }}
m2-monthly-branch-cache-key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}
m2-monthly-cache-key: ${{ steps.cache-key.outputs.m2-monthly-cache-key }}
m2-cache-key: ${{ steps.cache-key.outputs.m2-cache-key }}
quarkus-metadata-cache-key: ${{ steps.cache-key.outputs.quarkus-metadata-cache-key }}
quarkus-metadata-cache-key-default: ${{ steps.cache-key.outputs.quarkus-metadata-cache-key-default }}
Expand Down Expand Up @@ -79,9 +81,11 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
CURRENT_WEEK=$(/bin/date -u "+%Y-%U")
echo "quarkus-metadata-cache-key=quarkus-metadata-cache-${CURRENT_WEEK}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "quarkus-metadata-cache-key-default=quarkus-metadata-cache-${CURRENT_WEEK}-${{ github.event.repository.default_branch }}" >> $GITHUB_OUTPUT
Expand All @@ -90,7 +94,7 @@ jobs:
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down Expand Up @@ -232,8 +236,10 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# refresh cache every week to avoid unlimited growth
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
- name: Download .m2/repository/io/quarkus
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -335,8 +341,10 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# refresh cache every week to avoid unlimited growth
key: ${{ needs.build-jdk17.outputs.m2-cache-key }}
restore-keys: |
${{ needs.build-jdk17.outputs.m2-monthly-branch-cache-key }}-
${{ needs.build-jdk17.outputs.m2-monthly-cache-key }}-
- name: Download .m2/repository/io/quarkus
uses: actions/download-artifact@v4
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/owasp-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven Repository
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/podman-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven Repository
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
run: |
CURRENT_BRANCH="${{ github.repository != 'quarkusio/quarkus' && 'fork' || github.base_ref || github.ref_name }}"
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="m2-cache"
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
- name: Restore Maven Repository
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
# This will always fail but we will default to the best matching restore keys
key: ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-${{ github.run_id }}
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
Expand Down

0 comments on commit 612cc37

Please sign in to comment.