Skip to content

Commit 15e6538

Browse files
fix: add the distribution to the instruments cache key
`runner.os` evaluates to `Linux`, and the kernel version does not imply a release: containers report their host's kernel, and two images of different releases can ship the same one. Entries built against one release were therefore restored on another, and an Ubuntu 26.04 job could pick up a valgrind tree built for 24.04. Refs COD-3306 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4296e51 commit 15e6538

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ runs:
139139
KERNEL_VERSION=$(uname -r)
140140
echo "kernel-version=$KERNEL_VERSION" >> $GITHUB_OUTPUT
141141
142+
# Get the distribution for the cache key: instrument installations are built against a
143+
# specific release, and `runner.os` only says `Linux`
144+
if [ -r /etc/os-release ]; then
145+
. /etc/os-release
146+
DISTRO="$ID-$VERSION_ID"
147+
else
148+
DISTRO="${{ runner.os }}"
149+
fi
150+
echo "distro=$DISTRO" >> $GITHUB_OUTPUT
151+
142152
# Normalize mode for cache key (commas are not allowed in cache keys)
143153
MODE_CACHE_KEY=$(echo "${{ inputs.mode }}" | tr ',' '-')
144154
echo "mode-cache-key=$MODE_CACHE_KEY" >> $GITHUB_OUTPUT
@@ -148,9 +158,9 @@ runs:
148158
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
149159
with:
150160
path: ${{ inputs.instruments-cache-dir }}
151-
key: codspeed-instruments-${{ steps.versions.outputs.mode-cache-key }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.kernel-version }}-${{ steps.versions.outputs.runner-version }}
161+
key: codspeed-instruments-${{ steps.versions.outputs.mode-cache-key }}-${{ steps.versions.outputs.distro }}-${{ runner.arch }}-${{ steps.versions.outputs.kernel-version }}-${{ steps.versions.outputs.runner-version }}
152162
restore-keys: |
153-
codspeed-instruments-${{ steps.versions.outputs.mode-cache-key }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.versions.outputs.kernel-version }}-
163+
codspeed-instruments-${{ steps.versions.outputs.mode-cache-key }}-${{ steps.versions.outputs.distro }}-${{ runner.arch }}-${{ steps.versions.outputs.kernel-version }}-
154164
155165
- name: Lookup installer hash
156166
id: installer-hash

0 commit comments

Comments
 (0)