add one more retry and wait a little longer to allow ourselves to recover from infra issues (#2714)

This commit is contained in:
rkuo-danswer 2024-10-07 15:17:49 -07:00 committed by GitHub
parent 4214a3a6e2
commit 6fa8fabb47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,16 +32,20 @@ inputs:
description: 'Cache destinations' description: 'Cache destinations'
required: false required: false
retry-wait-time: retry-wait-time:
description: 'Time to wait before retry in seconds' description: 'Time to wait before attempt 2 in seconds'
required: false required: false
default: '5' default: '60'
retry-wait-time-2:
description: 'Time to wait before attempt 3 in seconds'
required: false
default: '120'
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: Build and push Docker image (First Attempt) - name: Build and push Docker image (Attempt 1 of 3)
id: buildx1 id: buildx1
uses: docker/build-push-action@v5 uses: docker/build-push-action@v6
continue-on-error: true continue-on-error: true
with: with:
context: ${{ inputs.context }} context: ${{ inputs.context }}
@ -54,16 +58,17 @@ runs:
cache-from: ${{ inputs.cache-from }} cache-from: ${{ inputs.cache-from }}
cache-to: ${{ inputs.cache-to }} cache-to: ${{ inputs.cache-to }}
- name: Wait to retry - name: Wait before attempt 2
if: steps.buildx1.outcome != 'success' if: steps.buildx1.outcome != 'success'
run: | run: |
echo "First attempt failed. Waiting ${{ inputs.retry-wait-time }} seconds before retry..." echo "First attempt failed. Waiting ${{ inputs.retry-wait-time }} seconds before retry..."
sleep ${{ inputs.retry-wait-time }} sleep ${{ inputs.retry-wait-time }}
shell: bash shell: bash
- name: Build and push Docker image (Retry Attempt) - name: Build and push Docker image (Attempt 2 of 3)
id: buildx2
if: steps.buildx1.outcome != 'success' if: steps.buildx1.outcome != 'success'
uses: docker/build-push-action@v5 uses: docker/build-push-action@v6
with: with:
context: ${{ inputs.context }} context: ${{ inputs.context }}
file: ${{ inputs.file }} file: ${{ inputs.file }}
@ -74,3 +79,31 @@ runs:
tags: ${{ inputs.tags }} tags: ${{ inputs.tags }}
cache-from: ${{ inputs.cache-from }} cache-from: ${{ inputs.cache-from }}
cache-to: ${{ inputs.cache-to }} cache-to: ${{ inputs.cache-to }}
- name: Wait before attempt 3
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success'
run: |
echo "Second attempt failed. Waiting ${{ inputs.retry-wait-time-2 }} seconds before retry..."
sleep ${{ inputs.retry-wait-time-2 }}
shell: bash
- name: Build and push Docker image (Attempt 3 of 3)
id: buildx3
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success'
uses: docker/build-push-action@v6
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
platforms: ${{ inputs.platforms }}
pull: ${{ inputs.pull }}
push: ${{ inputs.push }}
load: ${{ inputs.load }}
tags: ${{ inputs.tags }}
cache-from: ${{ inputs.cache-from }}
cache-to: ${{ inputs.cache-to }}
- name: Report failure
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success' && steps.buildx3.outcome != 'success'
run: |
echo "All attempts failed. Possible transient infrastucture issues? Try again later or inspect logs for details."
shell: bash