⚡ perf: optimize cache check using docker manifest inspect
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user