Skip to content

Commit 9fe12af

Browse files
committed
Save and load TiUP Playground image as artifact
- Save Docker image as compressed tar in prepare-dependencies job - Upload as artifact for test jobs to download and load - This ensures image is available immediately without rebuilds - Falls back to building if artifact not available
1 parent f6459cd commit 9fe12af

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ jobs:
8989
push: false
9090
load: true
9191

92+
- name: Save TiUP Playground Docker image
93+
run: |
94+
docker save terraform-provider-mysql-tiup-playground:latest | gzip > tiup-playground-image.tar.gz
95+
echo "Image saved: $(du -h tiup-playground-image.tar.gz | cut -f1)"
96+
9297
# Note: Tests now use testcontainers - no mysql-client or Docker Buildx caching needed
9398
# Testcontainers handles container lifecycle and image pulling automatically
94-
# TiUP Playground image is pre-built above with layer caching to speed up builds
99+
# TiUP Playground image is pre-built above and saved as artifact for test jobs
95100

96101
- name: Upload Terraform binary
97102
uses: actions/upload-artifact@v4
@@ -107,6 +112,14 @@ jobs:
107112
path: vendor/
108113
retention-days: 1
109114
compression-level: 6
115+
116+
- name: Upload TiUP Playground Docker image
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: tiup-playground-image
120+
path: tiup-playground-image.tar.gz
121+
retention-days: 1
122+
compression-level: 6
110123

111124
tests:
112125
runs-on: ubuntu-22.04
@@ -190,12 +203,21 @@ jobs:
190203
- name: Set up Docker Buildx
191204
uses: docker/setup-buildx-action@v3
192205

193-
- name: Load cached TiUP Playground Docker image
206+
- name: Download TiUP Playground Docker image
207+
uses: actions/download-artifact@v4
208+
with:
209+
name: tiup-playground-image
210+
path: ./
211+
212+
- name: Load TiUP Playground Docker image
194213
run: |
195-
# Try to load from cache - if not available, testcontainers will build it
196-
docker images | grep terraform-provider-mysql-tiup-playground || echo "TiUP Playground image not found, will be built on-demand"
214+
echo "Loading pre-built TiUP Playground Docker image..."
215+
gunzip -c tiup-playground-image.tar.gz | docker load
216+
docker images | grep terraform-provider-mysql-tiup-playground
217+
echo "✓ TiUP Playground image loaded successfully"
197218
198-
# Note: Docker Buildx is used for TiUP Playground image caching
219+
# Note: TiUP Playground image is pre-built in prepare-dependencies and loaded here
220+
# This avoids rebuilding the image during each test run
199221
# Testcontainers handles container lifecycle and image pulling automatically
200222

201223
- name: Run testcontainers tests via Makefile

0 commit comments

Comments
 (0)