Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,41 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Cache Docker images
uses: actions/cache@v4
id: docker-cache
with:
path: /tmp/.docker
key: ${{ runner.os }}-docker-images-${{ hashFiles('test/docker-compose.yml') }}
restore-keys: |
${{ runner.os }}-docker-images-
- name: Load Docker images from cache
if: steps.docker-cache.outputs.cache-hit == 'true'
run: |
if [ -f /tmp/.docker/images.tar ]; then
docker load -i /tmp/.docker/images.tar
fi
- name: Pull Docker images
run: |
docker compose -f test/docker-compose.yml pull
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Docker images pulled despite cache hit

The docker compose pull command runs unconditionally, even when cached images are successfully loaded. This defeats the caching mechanism's purpose by always pulling images from the registry regardless of cache hits, negating any performance benefits from the cache.

Additional Locations (1)

Fix in Cursor Fix in Web

- name: Save Docker images to cache
if: steps.docker-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/.docker
# Get all images from docker-compose.yml and save them
# Use a temporary file to store images list to avoid subshell issues
docker compose -f test/docker-compose.yml config --images > /tmp/.docker/images_list.txt 2>/dev/null || true
if [ -s /tmp/.docker/images_list.txt ]; then
while IFS= read -r img || [ -n "$img" ]; do
[ -z "$img" ] && continue
filename=$(echo "$img" | tr '/:' '_' | tr -d ' ')
docker save "$img" -o "/tmp/.docker/${filename}.tar" 2>/dev/null || true
done < /tmp/.docker/images_list.txt
# Combine all image tars into one compressed archive
if ls /tmp/.docker/*.tar 1> /dev/null 2>&1; then
cd /tmp/.docker && tar -czf images.tar.gz *.tar && rm -f *.tar images_list.txt && mv images.tar.gz images.tar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Cached images cannot be loaded correctly

The save step creates individual tar files per image, then combines them into a compressed archive using tar -czf. However, docker load expects the format produced by docker save, not a tar archive containing multiple tar files. This nested structure won't load correctly, causing the cache restoration to fail.

Additional Locations (1)

Fix in Cursor Fix in Web

fi
fi
- name: starts dependencies
run: |
mkdir -p test/output/otel
Expand Down Expand Up @@ -70,6 +105,41 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Cache Docker images
uses: actions/cache@v4
id: docker-cache
with:
path: /tmp/.docker
key: ${{ runner.os }}-docker-images-${{ hashFiles('test/docker-compose.yml') }}
restore-keys: |
${{ runner.os }}-docker-images-
- name: Load Docker images from cache
if: steps.docker-cache.outputs.cache-hit == 'true'
run: |
if [ -f /tmp/.docker/images.tar ]; then
docker load -i /tmp/.docker/images.tar
fi
- name: Pull Docker images
run: |
docker compose -f test/docker-compose.yml pull
- name: Save Docker images to cache
if: steps.docker-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/.docker
# Get all images from docker-compose.yml and save them
# Use a temporary file to store images list to avoid subshell issues
docker compose -f test/docker-compose.yml config --images > /tmp/.docker/images_list.txt 2>/dev/null || true
if [ -s /tmp/.docker/images_list.txt ]; then
while IFS= read -r img || [ -n "$img" ]; do
[ -z "$img" ] && continue
filename=$(echo "$img" | tr '/:' '_' | tr -d ' ')
docker save "$img" -o "/tmp/.docker/${filename}.tar" 2>/dev/null || true
done < /tmp/.docker/images_list.txt
# Combine all image tars into one compressed archive
if ls /tmp/.docker/*.tar 1> /dev/null 2>&1; then
cd /tmp/.docker && tar -czf images.tar.gz *.tar && rm -f *.tar images_list.txt && mv images.tar.gz images.tar
fi
fi
- name: starts dependencies
run: |
mkdir -p test/output/otel
Expand Down
Loading