Skip to content

Commit 293ba8c

Browse files
committed
Switch TiDB tests back to Docker images with Buildx caching
Replace TiUP playground with Docker-based TiDB cluster using Buildx caching: - Use tidb-test-cluster.sh script (Docker-based cluster) - Add Docker Buildx caching for TiDB component images (tidb, pd, tikv) - Create Dockerfile.tidb for pulling and caching TiDB images - Remove TiUP-related steps from workflow Benefits: - Docker images cached across workflow runs via Buildx GHA cache - More consistent with MySQL/Percona/MariaDB test approach - Better layer-level caching efficiency - Images persist across separate workflow runs Each TiDB test now: 1. Caches tidb, pd, and tikv images for that version using Buildx 2. Uses tidb-test-cluster.sh to start Docker-based cluster 3. Runs tests against the cluster 4. Cleans up cluster after tests
1 parent 06b2c8c commit 293ba8c

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,8 @@ jobs:
7575
- name: Vendor Go dependencies
7676
run: go mod vendor
7777

78-
- name: Cache TiUP binary
79-
id: cache-tiup-binary
80-
uses: actions/cache@v4
81-
with:
82-
path: |
83-
~/.tiup/bin
84-
~/.tiup/manifests
85-
# Cache TiUP binary separately (small, ~20MB)
86-
key: ${{ runner.os }}-tiup-binary-${{ hashFiles('.github/workflows/main.yml') }}
87-
restore-keys: |
88-
${{ runner.os }}-tiup-binary-
89-
90-
- name: Install TiUP
91-
run: |
92-
if ! command -v tiup &> /dev/null; then
93-
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
94-
fi
95-
echo "$HOME/.tiup/bin" >> $GITHUB_PATH
96-
97-
- name: Update TiUP and playground component
98-
run: |
99-
export PATH=$HOME/.tiup/bin:$PATH
100-
tiup update --self || true
101-
tiup update playground || true
102-
103-
# Note: TiDB components are NOT pre-downloaded here to avoid huge cache timeout
104-
# Each test job will download and cache only the version it needs (~700-800MB per version)
78+
# Note: TiDB tests now use Docker images with Buildx caching instead of TiUP
79+
# Docker images are cached per version in individual test jobs
10580

10681
- name: Pre-pull Docker images
10782
run: |

Dockerfile.tidb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Minimal Dockerfile for pulling and caching TiDB component images
2+
# This file is dynamically used by the workflow to pull images via Buildx
3+
4+
ARG TIDB_COMPONENT
5+
ARG TIDB_VERSION
6+
FROM ${TIDB_COMPONENT}:${TIDB_VERSION}
7+
8+
# No additional layers needed - just pulling the base image for caching

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ testtidb%:
8989
# WARNING: this does not work as a bare task run, it only instantiates correctly inside the versioned TiDB task run
9090
# otherwise MYSQL_PORT and version are unset.
9191
testtidb:
92-
@MYSQL_VERSION=$(MYSQL_VERSION) MYSQL_PORT=$(MYSQL_PORT) $(CURDIR)/scripts/tidb-playground.sh start || exit 1
92+
@MYSQL_VERSION=$(MYSQL_VERSION) MYSQL_PORT=$(MYSQL_PORT) $(CURDIR)/scripts/tidb-test-cluster.sh --init --port $(MYSQL_PORT) --version $(MYSQL_VERSION) || exit 1
9393
MYSQL_USERNAME="$(TEST_USER)" MYSQL_PASSWORD="" MYSQL_ENDPOINT=127.0.0.1:$(MYSQL_PORT) $(MAKE) testacc; \
9494
TEST_RESULT=$$?; \
95-
MYSQL_VERSION=$(MYSQL_VERSION) MYSQL_PORT=$(MYSQL_PORT) $(CURDIR)/scripts/tidb-playground.sh stop; \
95+
MYSQL_VERSION=$(MYSQL_VERSION) MYSQL_PORT=$(MYSQL_PORT) $(CURDIR)/scripts/tidb-test-cluster.sh --destroy || true; \
9696
exit $$TEST_RESULT
9797

9898
testmariadb%:

0 commit comments

Comments
 (0)