Skip to content

Commit 9ea7a56

Browse files
authored
compute kernel cache key before build: (#54)
## Description The kernel build writes .config.resolved into kernel.configs/, which changes the hashFiles('kernel.configs/*', ...) result between cache restore and save, producing mismatched keys and failed saves. Fixes: # ## How Has This Been Tested? ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents 8ffc693 + a59fec0 commit 9ea7a56

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,17 @@ jobs:
130130
docker tag "${{ env.BUILDER_IMAGE }}:${HASH}" "${REMOTE}:${HASH}-${{ matrix.arch }}"
131131
docker push "${REMOTE}:${HASH}-${{ matrix.arch }}"
132132
133+
- name: Compute kernel cache key
134+
id: kernel-cache-key
135+
run: echo "key=kernel-${{ matrix.arch }}-${{ env.KERNEL_VERSION }}-${{ hashFiles('kernel.configs/*', 'Dockerfile') }}" >> "$GITHUB_OUTPUT"
136+
133137
- name: Restore kernel cache
134138
id: kernel-cache
135139
uses: actions/cache/restore@v4
136140
with:
137141
path: |
138142
mkosi.output/kernel/${{ env.KERNEL_VERSION }}/${{ matrix.arch }}
139-
key: kernel-${{ matrix.arch }}-${{ env.KERNEL_VERSION }}-${{ hashFiles('kernel.configs/*', 'Dockerfile') }}
143+
key: ${{ steps.kernel-cache-key.outputs.key }}
140144

141145
- name: Install Python dependencies
142146
run: pip install -r requirements.txt
@@ -153,7 +157,7 @@ jobs:
153157
with:
154158
path: |
155159
mkosi.output/kernel/${{ env.KERNEL_VERSION }}/${{ matrix.arch }}
156-
key: kernel-${{ matrix.arch }}-${{ env.KERNEL_VERSION }}-${{ hashFiles('kernel.configs/*', 'Dockerfile') }}
160+
key: ${{ steps.kernel-cache-key.outputs.key }}
157161

158162
- name: Upload kernel artifacts
159163
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)