Skip to content

Commit cf82343

Browse files
committed
feat(workflows): add Docker image caching option to release workflow
- Introduced `enable_docker_image_cache` input to enable caching of Testcontainers Docker images. - Updated steps to conditionally cache, load, and save Docker images based on the new input.
1 parent 033dced commit cf82343

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
required: false
3333
default: false
3434
type: boolean
35+
enable_docker_image_cache:
36+
description: "Cache Testcontainers Docker images as a tar archive. Disabled by default because save/load can be slower than pulling."
37+
required: false
38+
default: false
39+
type: boolean
3540

3641
permissions:
3742
contents: write
@@ -66,6 +71,7 @@ jobs:
6671
GRADLE_LOG_LEVEL: ${{ github.event.inputs.gradle_log_level || 'info' }}
6772
SKIP_TESTS: ${{ github.event.inputs.skip_tests || 'false' }}
6873
PUBLISH_GITHUB_PACKAGES: ${{ github.event.inputs.publish_github_packages || 'false' }}
74+
ENABLE_DOCKER_IMAGE_CACHE: ${{ github.event.inputs.enable_docker_image_cache || 'false' }}
6975
TESTCONTAINERS_RYUK_DISABLED: "true"
7076
DOCKER_IMAGE_CACHE_DIR: /tmp/bigdata-test-docker-image-cache
7177
DOCKER_IMAGE_CACHE_FILE: /tmp/bigdata-test-docker-image-cache/spark-matrix-images.tar
@@ -100,7 +106,7 @@ jobs:
100106
docker info
101107
102108
- name: Cache Spark matrix Docker images
103-
if: env.SKIP_TESTS != 'true'
109+
if: env.SKIP_TESTS != 'true' && env.ENABLE_DOCKER_IMAGE_CACHE == 'true'
104110
id: docker-image-cache
105111
uses: actions/cache@v4
106112
with:
@@ -110,7 +116,7 @@ jobs:
110116
${{ runner.os }}-spark-matrix-docker-images-v1-
111117
112118
- name: Load cached Spark matrix Docker images
113-
if: env.SKIP_TESTS != 'true'
119+
if: env.SKIP_TESTS != 'true' && env.ENABLE_DOCKER_IMAGE_CACHE == 'true'
114120
run: |
115121
if [ -s "$DOCKER_IMAGE_CACHE_FILE" ]; then
116122
docker load --input "$DOCKER_IMAGE_CACHE_FILE"
@@ -155,7 +161,7 @@ jobs:
155161
done
156162
157163
- name: Save Spark matrix Docker images
158-
if: env.SKIP_TESTS != 'true'
164+
if: env.SKIP_TESTS != 'true' && env.ENABLE_DOCKER_IMAGE_CACHE == 'true'
159165
run: |
160166
set -euo pipefail
161167
mkdir -p "$DOCKER_IMAGE_CACHE_DIR"

0 commit comments

Comments
 (0)