From 612cc377e5d8990f2a1df4804288d6fbd58b9e15 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 20 Aug 2024 13:16:49 +0200 Subject: [PATCH] Don't save a cache per run id A daily cache is enough. Otherwise we will have a lot of entries. (cherry picked from commit 7762ac58959908d837810d08182b41920c980fdb) --- .github/workflows/ci-actions-incremental.yml | 29 ++++++++++--------- .github/workflows/deploy-snapshots.yml | 5 ++-- .github/workflows/doc-build.yml | 5 ++-- .../workflows/native-it-selected-graalvm.yml | 14 +++++++-- .github/workflows/owasp-check.yml | 5 ++-- .github/workflows/podman-build.yml | 5 ++-- .github/workflows/sonarcloud.yml | 5 ++-- 7 files changed, 42 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci-actions-incremental.yml b/.github/workflows/ci-actions-incremental.yml index 1d37bc505f722..10146af2b6b4b 100644 --- a/.github/workflows/ci-actions-incremental.yml +++ b/.github/workflows/ci-actions-incremental.yml @@ -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: @@ -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 @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- @@ -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 }}- diff --git a/.github/workflows/deploy-snapshots.yml b/.github/workflows/deploy-snapshots.yml index 2b2d89cc9987e..ec7208945c1a9 100644 --- a/.github/workflows/deploy-snapshots.yml +++ b/.github/workflows/deploy-snapshots.yml @@ -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 }}- diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 5068bd8b31229..137e9b99695e7 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -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 }}- diff --git a/.github/workflows/native-it-selected-graalvm.yml b/.github/workflows/native-it-selected-graalvm.yml index 319a4e831b81a..30ef6bf08f6df 100644 --- a/.github/workflows/native-it-selected-graalvm.yml +++ b/.github/workflows/native-it-selected-graalvm.yml @@ -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 }} @@ -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 @@ -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 }}- @@ -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: @@ -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: diff --git a/.github/workflows/owasp-check.yml b/.github/workflows/owasp-check.yml index be8e2b9e987fb..deaf8f8c4fa50 100644 --- a/.github/workflows/owasp-check.yml +++ b/.github/workflows/owasp-check.yml @@ -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 }}- diff --git a/.github/workflows/podman-build.yml b/.github/workflows/podman-build.yml index 1a0bba62021a1..8460ae9443afb 100644 --- a/.github/workflows/podman-build.yml +++ b/.github/workflows/podman-build.yml @@ -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 }}- diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9c3ae07a62cb8..68d328b6fbc96 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -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 }}-