Skip to content

Commit 547972b

Browse files
committed
Add Docker Buildx caching for TiDB component images
Add Buildx caching steps for tidb, pd, and tikv Docker images. Each component is cached separately per version using GHA cache backend.
1 parent 96f93e2 commit 547972b

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,51 @@ jobs:
220220
echo "version=${VERSION}" >> $GITHUB_OUTPUT
221221
echo "TiDB version for this test: ${VERSION}"
222222
223+
- name: Set up Docker Buildx for TiDB
224+
if: contains(matrix.target, 'tidb')
225+
uses: docker/setup-buildx-action@v3
226+
227+
- name: Cache TiDB Docker images using Buildx
228+
if: contains(matrix.target, 'tidb')
229+
uses: docker/build-push-action@v5
230+
with:
231+
context: .
232+
file: Dockerfile.tidb
233+
push: false
234+
tags: pingcap/tidb:v${{ steps.extract-tidb-version.outputs.version }}
235+
build-args: |
236+
TIDB_COMPONENT=pingcap/tidb
237+
TIDB_VERSION=v${{ steps.extract-tidb-version.outputs.version }}
238+
cache-from: type=gha,scope=tidb-v${{ steps.extract-tidb-version.outputs.version }}
239+
cache-to: type=gha,mode=max,scope=tidb-v${{ steps.extract-tidb-version.outputs.version }}
240+
241+
- name: Cache PD Docker image using Buildx
242+
if: contains(matrix.target, 'tidb')
243+
uses: docker/build-push-action@v5
244+
with:
245+
context: .
246+
file: Dockerfile.tidb
247+
push: false
248+
tags: pingcap/pd:v${{ steps.extract-tidb-version.outputs.version }}
249+
build-args: |
250+
TIDB_COMPONENT=pingcap/pd
251+
TIDB_VERSION=v${{ steps.extract-tidb-version.outputs.version }}
252+
cache-from: type=gha,scope=pd-v${{ steps.extract-tidb-version.outputs.version }}
253+
cache-to: type=gha,mode=max,scope=pd-v${{ steps.extract-tidb-version.outputs.version }}
254+
255+
- name: Cache TiKV Docker image using Buildx
256+
if: contains(matrix.target, 'tidb')
257+
uses: docker/build-push-action@v5
258+
with:
259+
context: .
260+
file: Dockerfile.tidb
261+
push: false
262+
tags: pingcap/tikv:v${{ steps.extract-tidb-version.outputs.version }}
263+
build-args: |
264+
TIDB_COMPONENT=pingcap/tikv
265+
TIDB_VERSION=v${{ steps.extract-tidb-version.outputs.version }}
266+
cache-from: type=gha,scope=tikv-v${{ steps.extract-tidb-version.outputs.version }}
267+
cache-to: type=gha,mode=max,scope=tikv-v${{ steps.extract-tidb-version.outputs.version }}
223268

224269
- name: Run tests {{ matrix.target }}
225270
env:

0 commit comments

Comments
 (0)