fix(ci): retry buildx push and fallback without cache export
This commit is contained in:
parent
654754a107
commit
e7a1f346e8
1 changed files with 32 additions and 8 deletions
|
|
@ -162,11 +162,35 @@ jobs:
|
|||
exit 0
|
||||
fi
|
||||
|
||||
docker buildx build --push \
|
||||
-f Dockerfile.simple \
|
||||
--build-arg SERVICE_NAME=${{ matrix.service }} \
|
||||
--cache-from type=registry,ref=$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:buildcache \
|
||||
--cache-to type=registry,ref=$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:buildcache,mode=max \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:${{ gitea.sha }}" \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:high-performance-latest" \
|
||||
.
|
||||
build_with_cache() {
|
||||
docker buildx build --push \
|
||||
-f Dockerfile.simple \
|
||||
--build-arg SERVICE_NAME=${{ matrix.service }} \
|
||||
--cache-from type=registry,ref=$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:buildcache \
|
||||
--cache-to type=registry,ref=$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:buildcache,mode=max \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:${{ gitea.sha }}" \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:high-performance-latest" \
|
||||
.
|
||||
}
|
||||
|
||||
build_without_cache_export() {
|
||||
docker buildx build --push \
|
||||
-f Dockerfile.simple \
|
||||
--build-arg SERVICE_NAME=${{ matrix.service }} \
|
||||
--cache-from type=registry,ref=$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:buildcache \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:${{ gitea.sha }}" \
|
||||
-t "$REGISTRY_HOSTPORT/nxtgauge-rust-${{ matrix.service }}:high-performance-latest" \
|
||||
.
|
||||
}
|
||||
|
||||
for attempt in 1 2 3; do
|
||||
echo "Build attempt $attempt with cache export for ${{ matrix.service }}"
|
||||
if build_with_cache; then
|
||||
exit 0
|
||||
fi
|
||||
echo "Attempt $attempt failed; retrying after backoff"
|
||||
sleep $((attempt * 10))
|
||||
done
|
||||
|
||||
echo "Falling back to build without cache export for ${{ matrix.service }}"
|
||||
build_without_cache_export
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue