perf: optimize cache check using docker manifest inspect

This commit is contained in:
2026-04-08 11:21:24 +02:00
parent ec869d6d5b
commit 48cb881af0

View File

@@ -76,15 +76,18 @@ jobs:
echo "Dependency hash: $DEPS_HASH"
echo "deps_hash=$DEPS_HASH" >> $GITHUB_OUTPUT
- name: Check for existing cache
- name: Check for existing cache (optimized)
id: check_cache
run: |
# Check if image exists in registry
# Check if image exists in registry using optimized approach
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}-build-cache:${{ steps.calculate_hash.outputs.deps_hash }}"
# Try to pull the image to see if it exists
if docker pull "$IMAGE_NAME" >/dev/null 2>&1; then
echo "✅ Cache hit - using existing build cache"
# Fast check using docker manifest inspect (lighter than pull)
echo "🔍 Checking cache: $IMAGE_NAME"
# Try manifest inspect first (fastest method)
if docker manifest inspect "$IMAGE_NAME" >/dev/null 2>&1; then
echo "✅ Cache hit - using existing build cache (manifest inspect)"
echo "cache_hit=true" >> $GITHUB_OUTPUT
else
echo "⚠️ Cache miss - will build new cache image"