Skip to content

Commit f4e11da

Browse files
authored
Add retry logic to docker.io image push step (home-assistant#157859)
1 parent e0238b5 commit f4e11da

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/builder.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,19 @@ jobs:
416416
ARCHS=$(echo '${{ needs.init.outputs.architectures }}' | jq -r '.[]')
417417
for arch in $ARCHS; do
418418
echo "Copying ${arch} image to DockerHub..."
419-
docker buildx imagetools create \
420-
--tag "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}" \
421-
"ghcr.io/home-assistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"
419+
for attempt in 1 2 3; do
420+
if docker buildx imagetools create \
421+
--tag "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}" \
422+
"ghcr.io/home-assistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"; then
423+
break
424+
fi
425+
echo "Attempt ${attempt} failed, retrying in 10 seconds..."
426+
sleep 10
427+
if [ "${attempt}" -eq 3 ]; then
428+
echo "Failed after 3 attempts"
429+
exit 1
430+
fi
431+
done
422432
cosign sign --yes "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"
423433
done
424434

0 commit comments

Comments
 (0)