Skip to content

Commit 7158f48

Browse files
Fix key match
1 parent afa442a commit 7158f48

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/test_roles_pr.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ jobs:
105105
run: |
106106
WANT_KEY="${{ runner.os }}-apt-elastic-${{ steps.elastic-version.outputs.version }}"
107107
echo "=== Looking for key: ${WANT_KEY} ==="
108-
echo "=== All caches with prefix '${{ runner.os }}-apt-elastic-${{ matrix.release }}.' ==="
109-
gh api "repos/${{ github.repository }}/actions/caches?key=${{ runner.os }}-apt-elastic-${{ matrix.release }}.&per_page=100" \
108+
echo "=== All caches in repo ==="
109+
gh api "repos/${{ github.repository }}/actions/caches?per_page=100" \
110110
| jq -r '.actions_caches[] | "\(.key) size=\(.size_in_bytes) created=\(.created_at)"'
111111
echo "=== Total cache count in repo ==="
112112
gh api "repos/${{ github.repository }}/actions/caches?per_page=1" | jq '.total_count'
@@ -120,6 +120,7 @@ jobs:
120120
key: ${{ runner.os }}-apt-elastic-${{ steps.elastic-version.outputs.version }}
121121
restore-keys: |
122122
${{ runner.os }}-apt-elastic-${{ matrix.release }}.
123+
save-always: true
123124

124125
- name: Pre-download Elastic packages to apt cache
125126
if: (contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian')) && steps.apt-cache.outputs.cache-hit != 'true'
@@ -133,6 +134,8 @@ jobs:
133134
sudo apt-get install -y --download-only \
134135
-o Dir::Cache::archives=/tmp/elastic-apt-cache \
135136
elasticsearch logstash kibana filebeat
137+
sudo rm -f /tmp/elastic-apt-cache/lock
138+
sudo rm -rf /tmp/elastic-apt-cache/partial
136139
137140
- name: Delete outdated Elastic apt caches
138141
if: (contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian')) && steps.apt-cache.outputs.cache-hit != 'true'
@@ -244,8 +247,8 @@ jobs:
244247
run: |
245248
WANT_KEY="${{ runner.os }}-apt-elastic-${{ steps.elastic-version.outputs.version }}"
246249
echo "=== Looking for key: ${WANT_KEY} ==="
247-
echo "=== All caches with prefix '${{ runner.os }}-apt-elastic-${{ matrix.release }}.' ==="
248-
gh api "repos/${{ github.repository }}/actions/caches?key=${{ runner.os }}-apt-elastic-${{ matrix.release }}.&per_page=100" \
250+
echo "=== All caches in repo ==="
251+
gh api "repos/${{ github.repository }}/actions/caches?per_page=100" \
249252
| jq -r '.actions_caches[] | "\(.key) size=\(.size_in_bytes) created=\(.created_at)"'
250253
echo "=== Total cache count in repo ==="
251254
gh api "repos/${{ github.repository }}/actions/caches?per_page=1" | jq '.total_count'
@@ -259,6 +262,7 @@ jobs:
259262
key: ${{ runner.os }}-apt-elastic-${{ steps.elastic-version.outputs.version }}
260263
restore-keys: |
261264
${{ runner.os }}-apt-elastic-${{ matrix.release }}.
265+
save-always: true
262266

263267
- name: Pre-download Elastic packages to apt cache
264268
if: (contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian')) && steps.apt-cache.outputs.cache-hit != 'true'
@@ -272,6 +276,8 @@ jobs:
272276
sudo apt-get install -y --download-only \
273277
-o Dir::Cache::archives=/tmp/elastic-apt-cache \
274278
elasticsearch logstash kibana filebeat
279+
sudo rm -f /tmp/elastic-apt-cache/lock
280+
sudo rm -rf /tmp/elastic-apt-cache/partial
275281
276282
- name: Delete outdated Elastic apt caches
277283
if: (contains(matrix.distro, 'ubuntu') || contains(matrix.distro, 'debian')) && steps.apt-cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)