fix(ci): 临时禁用registry cache-to,ACR推送缓存太慢导致构建超时 #378
@@ -54,38 +54,38 @@ echo ""
|
||||
echo "Image pushed: ${IMAGE_TAG}"
|
||||
echo "Local cache updated"
|
||||
|
||||
echo ""
|
||||
echo "=== Step 2: Sync registry cache (best effort, retries 3x) ==="
|
||||
CACHE_TO_REGISTRY="type=registry,ref=${CACHE_REF},mode=max,compression=zstd"
|
||||
|
||||
MAX_RETRIES=3
|
||||
SUCCESS=0
|
||||
for attempt in $(seq 1 $MAX_RETRIES); do
|
||||
echo "Registry cache sync attempt $attempt/$MAX_RETRIES"
|
||||
if docker buildx build \
|
||||
$BUILD_ARGS \
|
||||
--cache-from "${CACHE_FROM_LOCAL}" \
|
||||
--cache-to "${CACHE_TO_REGISTRY}" \
|
||||
-f "${DOCKERFILE}" \
|
||||
-t "${IMAGE_TAG}" \
|
||||
--push \
|
||||
.; then
|
||||
echo "Registry cache synced (attempt $attempt)"
|
||||
SUCCESS=1
|
||||
break
|
||||
else
|
||||
echo "Registry cache sync failed (attempt $attempt)"
|
||||
if [ $attempt -lt $MAX_RETRIES ]; then
|
||||
WAIT=$((attempt * 5))
|
||||
echo "Retrying in ${WAIT}s..."
|
||||
sleep $WAIT
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $SUCCESS -eq 0 ]; then
|
||||
echo "WARNING: Registry cache sync failed after $MAX_RETRIES attempts (non-fatal, local cache still works)"
|
||||
fi
|
||||
# DISABLED: registry cache too slow echo ""
|
||||
# DISABLED: registry cache too slow echo "=== Step 2: Sync registry cache (best effort, retries 3x) ==="
|
||||
# DISABLED: registry cache too slow CACHE_TO_REGISTRY="type=registry,ref=${CACHE_REF},mode=max,compression=zstd"
|
||||
# DISABLED: registry cache too slow
|
||||
# DISABLED: registry cache too slow MAX_RETRIES=3
|
||||
# DISABLED: registry cache too slow SUCCESS=0
|
||||
# DISABLED: registry cache too slow for attempt in $(seq 1 $MAX_RETRIES); do
|
||||
# DISABLED: registry cache too slow echo "Registry cache sync attempt $attempt/$MAX_RETRIES"
|
||||
# DISABLED: registry cache too slow if docker buildx build \
|
||||
# DISABLED: registry cache too slow $BUILD_ARGS \
|
||||
# DISABLED: registry cache too slow --cache-from "${CACHE_FROM_LOCAL}" \
|
||||
# DISABLED: registry cache too slow --cache-to "${CACHE_TO_REGISTRY}" \
|
||||
# DISABLED: registry cache too slow -f "${DOCKERFILE}" \
|
||||
# DISABLED: registry cache too slow -t "${IMAGE_TAG}" \
|
||||
# DISABLED: registry cache too slow --push \
|
||||
# DISABLED: registry cache too slow .; then
|
||||
# DISABLED: registry cache too slow echo "Registry cache synced (attempt $attempt)"
|
||||
# DISABLED: registry cache too slow SUCCESS=1
|
||||
# DISABLED: registry cache too slow break
|
||||
# DISABLED: registry cache too slow else
|
||||
# DISABLED: registry cache too slow echo "Registry cache sync failed (attempt $attempt)"
|
||||
# DISABLED: registry cache too slow if [ $attempt -lt $MAX_RETRIES ]; then
|
||||
# DISABLED: registry cache too slow WAIT=$((attempt * 5))
|
||||
# DISABLED: registry cache too slow echo "Retrying in ${WAIT}s..."
|
||||
# DISABLED: registry cache too slow sleep $WAIT
|
||||
# DISABLED: registry cache too slow fi
|
||||
# DISABLED: registry cache too slow fi
|
||||
# DISABLED: registry cache too slow done
|
||||
# DISABLED: registry cache too slow
|
||||
# DISABLED: registry cache too slow if [ $SUCCESS -eq 0 ]; then
|
||||
# DISABLED: registry cache too slow echo "WARNING: Registry cache sync failed after $MAX_RETRIES attempts (non-fatal, local cache still works)"
|
||||
# DISABLED: registry cache too slow fi
|
||||
|
||||
echo ""
|
||||
echo "Build completed: ${IMAGE_TAG}"
|
||||
|
||||
Reference in New Issue
Block a user