Skip to content

Commit 2897ce5

Browse files
authored
Add retry to merge
1 parent 8f3dfe1 commit 2897ce5

File tree

1 file changed

+40
-35
lines changed

1 file changed

+40
-35
lines changed

.github/workflows/build_containers.yaml

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -234,42 +234,47 @@ jobs:
234234
tags: |
235235
type=raw,value={{branch}}
236236
237-
- name: Create manifest list and push
238-
shell: bash
239-
run: |
240-
set -x
241-
# Prepare tags
242-
echo '${{ steps.meta2.outputs.tags }}' > /tmp/tags
243-
cat /tmp/tags | xargs -i bash -c 'printf "%s" "-t {} " >> /tmp/tagargs'
244-
TAG_ARGS="$(cat /tmp/tagargs)"
245-
TAGS="$(cat /tmp/tags)"
246-
247-
R_VER=$(docker pull ${{ matrix.base.image }}:${{ matrix.base.amdtag }} 2>&1 > /dev/null && \
248-
docker inspect ${{ matrix.base.image }}:${{ matrix.base.amdtag }} | \
249-
jq -r '.[].Config.Env[]|select(match("^R_VERSION"))|.[index("=")+1:]')
250-
if [ ! -z "$R_VER" ]; then
251-
for tag in $TAGS; do
252-
TAG_ARGS="$TAG_ARGS -t ${tag}-R-${R_VER} -t ${tag}-r-${R_VER}"
237+
- name: Create manifest list and push with retries
238+
uses: nick-fields/retry@v3
239+
with:
240+
timeout_minutes: 30
241+
max_attempts: 10
242+
shell: bash
243+
command: |
244+
set -x
245+
# Prepare tags
246+
echo '${{ steps.meta2.outputs.tags }}' > /tmp/tags
247+
rm /tmp/tagargs || true
248+
cat /tmp/tags | xargs -i bash -c 'printf "%s" "-t {} " >> /tmp/tagargs'
249+
TAG_ARGS="$(cat /tmp/tagargs)"
250+
TAGS="$(cat /tmp/tags)"
251+
252+
R_VER=$(docker pull ${{ matrix.base.image }}:${{ matrix.base.amdtag }} 2>&1 > /dev/null && \
253+
docker inspect ${{ matrix.base.image }}:${{ matrix.base.amdtag }} | \
254+
jq -r '.[].Config.Env[]|select(match("^R_VERSION"))|.[index("=")+1:]')
255+
if [ ! -z "$R_VER" ]; then
256+
for tag in $TAGS; do
257+
TAG_ARGS="$TAG_ARGS -t ${tag}-R-${R_VER} -t ${tag}-r-${R_VER}"
258+
done
259+
fi
260+
261+
# Add alternative tags without _docker in name
262+
if [[ "${{ matrix.base.outname }}" == *"_docker"* ]]; then
263+
ALT_TAG=$(echo $TAG_ARGS | sed 's/_docker//g')
264+
TAG_ARGS="$TAG_ARGS $ALT_TAG"
265+
fi
266+
267+
CONTAINERNAME=$(echo '${{ steps.meta1.outputs.tags }}' | awk -F':' '{print $1}')
268+
269+
# Create manifest list
270+
DIGESTS=""
271+
for eachdir in $(ls /tmp/digests); do
272+
DIGESTS_ARCH=$(cd /tmp/digests/$eachdir && find . -type f -exec echo "$CONTAINERNAME@sha256{}" \; | sed 's/\.\//:/')
273+
DIGESTS="$DIGESTS $DIGESTS_ARCH"
253274
done
254-
fi
255-
256-
# Add alternative tags without _docker in name
257-
if [[ "${{ matrix.base.outname }}" == *"_docker"* ]]; then
258-
ALT_TAG=$(echo $TAG_ARGS | sed 's/_docker//g')
259-
TAG_ARGS="$TAG_ARGS $ALT_TAG"
260-
fi
261-
262-
CONTAINERNAME=$(echo '${{ steps.meta1.outputs.tags }}' | awk -F':' '{print $1}')
263-
264-
# Create manifest list
265-
DIGESTS=""
266-
for eachdir in $(ls /tmp/digests); do
267-
DIGESTS_ARCH=$(cd /tmp/digests/$eachdir && find . -type f -exec echo "$CONTAINERNAME@sha256{}" \; | sed 's/\.\//:/')
268-
DIGESTS="$DIGESTS $DIGESTS_ARCH"
269-
done
270-
echo "$TAG_ARGS"
271-
echo "$DIGESTS"
272-
docker buildx imagetools create $TAG_ARGS $DIGESTS
275+
echo "$TAG_ARGS"
276+
echo "$DIGESTS"
277+
docker buildx imagetools create $TAG_ARGS $DIGESTS
273278

274279
- name: Inspect images
275280
run: |

0 commit comments

Comments
 (0)