Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

disable CodeQL overlay DB cache (#79987)

Chris Vandoodewaarda68d9424ca39
diff --git a/.github/workflows/cache-cleanup-codeql.yml b/.github/workflows/cache-cleanup-codeql.yml
deleted file mode 100644
index b4971d5ec57..00000000000
--- a/.github/workflows/cache-cleanup-codeql.yml
+++ /dev/null
@@ -1,83 +0,0 @@
-# CodeQL's overlay analysis saves a ~400MB "base database" cache on every master run, keyed by commit SHA.
-#
-# Only the newest entry is ever restored: CodeQL looks its cache up by key *prefix* and takes the most recent match,
-# so everything behind it is dead weight. This job keeps the newest few and deletes the rest.
-name: CodeQL Cache Cleanup
-
-on:
- schedule:
- - cron: "0 4 * * *" # daily at 04:00 UTC
- workflow_dispatch:
- inputs:
- keep:
- description: "How many of the newest CodeQL caches to keep"
- required: false
- default: "2"
- dry-run:
- description: "List what would be deleted without deleting it"
- type: boolean
- required: false
- default: false
-
-concurrency:
- group: cache-cleanup-codeql
- cancel-in-progress: false
-
-permissions:
- actions: write # required to delete cache entries
- contents: read
-
-jobs:
- cleanup:
- # don't run the schedule on forks
- if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 10
- env:
- GH_TOKEN: ${{ github.token }}
- KEEP: ${{ github.event.inputs.keep || '2' }}
- DRY_RUN: ${{ github.event.inputs.dry-run || 'false' }}
- PREFIX: codeql-overlay-base-database-
- steps:
- - name: Delete superseded CodeQL caches
- shell: bash
- run: |
- set -euo pipefail
-
- # created_at is ISO-8601, so a reverse lexicographic sort is newest-first.
- gh api --paginate "/repos/${GITHUB_REPOSITORY}/actions/caches?per_page=100" \
- --jq ".actions_caches[] | select(.key | startswith(\"${PREFIX}\")) | \"\(.created_at)\t\(.id)\t\(.size_in_bytes)\t\(.key)\"" \
- | sort -r > all.tsv || true
-
- found=$(wc -l < all.tsv | tr -d ' ')
- echo "Found $found cache(s) matching '${PREFIX}'; keeping the newest $KEEP."
- if [ "$found" -eq 0 ]; then
- echo "Nothing to do." >> "$GITHUB_STEP_SUMMARY"
- exit 0
- fi
-
- tail -n +$((KEEP + 1)) all.tsv > doomed.tsv || true
- doomed=$(wc -l < doomed.tsv | tr -d ' ')
-
- freed=0
- while IFS=$'\t' read -r created id size key; do
- [ -z "${id:-}" ] && continue
- echo " deleting $key ($((size / 1000000))MB, created $created)"
- if [ "$DRY_RUN" = "true" ]; then
- echo " (dry run — not deleted)"
- else
- # A cache can vanish between listing and deleting (concurrent eviction); don't fail the job over it.
- gh api --method DELETE "/repos/${GITHUB_REPOSITORY}/actions/caches/${id}" >/dev/null \
- || echo " (already gone, skipping)"
- fi
- freed=$((freed + size))
- done < doomed.tsv
-
- {
- echo "### CodeQL cache cleanup"
- echo ""
- echo "- matched: **$found**"
- echo "- kept (newest): **$KEEP**"
- echo "- deleted: **$doomed**"
- echo "- reclaimed: **$((freed / 1000000)) MB**${DRY_RUN:+ (dry run: $DRY_RUN)}"
- } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/lint.security.yml b/.github/workflows/lint.security.yml
index bbf4143c4fd..59a61a5ddaa 100644
--- a/.github/workflows/lint.security.yml
+++ b/.github/workflows/lint.security.yml
@@ -17,6 +17,9 @@ jobs:
codeql:
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
timeout-minutes: 10
+ env:
+ # disables overlay DB cache
+ CODEQL_OVERLAY_DATABASE_MODE: none
steps:
- uses: actions/checkout@v6