Skip to content

Commit ca5c7c5

Browse files
authored
Merge pull request #176 from valkey-io/mkmkme/docker-cache-fix
github: fix caching the docker images
2 parents 21f098c + 6c97033 commit ca5c7c5

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/integration.yaml

+17-6
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,19 @@ jobs:
5050
pip install -r dev_requirements.txt
5151
invoke linters
5252
53+
get-date:
54+
name: Get current date for cache
55+
outputs:
56+
current_date: ${{ steps.date.outputs.current_date }}
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Set current date
60+
id: date
61+
run: echo "current_date=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
62+
5363
populate-cache:
5464
runs-on: ubuntu-latest
65+
needs: [get-date, dependency-audit, lint]
5566
timeout-minutes: 60
5667
name: Update docker cache
5768
steps:
@@ -61,8 +72,8 @@ jobs:
6172
uses: actions/cache@v4
6273
with:
6374
path: ./custom-cache/
64-
key: custom-cache
65-
- if: ${{ steps.custom-cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' }}
75+
key: custom-cache-${{ needs.get-date.outputs.current_date }}
76+
- if: ${{ steps.custom-cache.outputs.cache-hit != 'true' }}
6677
name: Update Cache
6778
run: |
6879
mkdir -p ./custom-cache/
@@ -72,7 +83,7 @@ jobs:
7283
7384
run-tests:
7485
runs-on: ubuntu-latest
75-
needs: [populate-cache]
86+
needs: [populate-cache, get-date]
7687
timeout-minutes: 60
7788
strategy:
7889
max-parallel: 15
@@ -98,7 +109,7 @@ jobs:
98109
with:
99110
path: ./custom-cache/
100111
fail-on-cache-miss: true
101-
key: custom-cache
112+
key: custom-cache-${{ needs.get-date.outputs.current_date }}
102113
- name: Use Cache
103114
run: docker image load -i ./custom-cache/all.tar
104115

@@ -137,7 +148,7 @@ jobs:
137148
build_and_test_package:
138149
name: Validate building and installing the package
139150
runs-on: ubuntu-latest
140-
needs: [run-tests]
151+
needs: [run-tests, get-date, populate-cache]
141152
strategy:
142153
fail-fast: false
143154
matrix:
@@ -154,7 +165,7 @@ jobs:
154165
with:
155166
path: ./custom-cache/
156167
fail-on-cache-miss: true
157-
key: custom-cache
168+
key: custom-cache-${{ needs.get-date.outputs.current_date }}
158169
- name: Use Cache
159170
run: docker image load -i ./custom-cache/all.tar
160171

0 commit comments

Comments
 (0)