Skip to content

Commit 7dddd89

Browse files
edenhausfrenck
authored andcommitted
Add retry logic to docker.io image push step (home-assistant#157859)
1 parent a2322ef commit 7dddd89

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
@@ -418,9 +418,19 @@ jobs:
418418
ARCHS=$(echo '${{ needs.init.outputs.architectures }}' | jq -r '.[]')
419419
for arch in $ARCHS; do
420420
echo "Copying ${arch} image to DockerHub..."
421-
docker buildx imagetools create \
422-
--tag "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}" \
423-
"ghcr.io/home-assistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"
421+
for attempt in 1 2 3; do
422+
if docker buildx imagetools create \
423+
--tag "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}" \
424+
"ghcr.io/home-assistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"; then
425+
break
426+
fi
427+
echo "Attempt ${attempt} failed, retrying in 10 seconds..."
428+
sleep 10
429+
if [ "${attempt}" -eq 3 ]; then
430+
echo "Failed after 3 attempts"
431+
exit 1
432+
fi
433+
done
424434
cosign sign --yes "docker.io/homeassistant/${arch}-homeassistant:${{ needs.init.outputs.version }}"
425435
done
426436

0 commit comments

Comments
 (0)