From be0f4378fef317b2f21e0f78f8853312a661e544 Mon Sep 17 00:00:00 2001 From: binhex Date: Wed, 21 Apr 2021 13:49:02 +0100 Subject: [PATCH] update workflow with retry action --- .../docker-manual-triggered-test.yml | 64 +++++++++---- .../workflows/docker-tag-triggered-prod.yml | 90 +++++++++++++------ 2 files changed, 110 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker-manual-triggered-test.yml b/.github/workflows/docker-manual-triggered-test.yml index 0c4974c..d652dbd 100644 --- a/.github/workflows/docker-manual-triggered-test.yml +++ b/.github/workflows/docker-manual-triggered-test.yml @@ -14,12 +14,18 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Update runc (temporary fix) # TODO: Remove step when https://github.com/actions/virtual-environments/issues/2658 fixed - run: | - sudo apt-get install libseccomp-dev - git clone https://github.com/opencontainers/runc - cd runc - make - sudo make install + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + sudo apt-get install libseccomp-dev + git clone https://github.com/opencontainers/runc + cd runc + make + sudo make install - name: Login to Docker Hub uses: docker/login-action@v1 with: @@ -32,17 +38,41 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.CR_PAT }} - name: Show Runners environment (debug) - shell: bash - run: export + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + export - name: Build Docker image and tag - run: | - docker build \ - --tag ${{ github.repository }}:${{ github.event.inputs.tags }} \ - --tag ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }} \ - . + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker build \ + --tag ${{ github.repository }}:${{ github.event.inputs.tags }} \ + --tag ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }} \ + . - name: Push Docker image to Docker Hub - run: | - docker push ${{ github.repository }}:${{ github.event.inputs.tags }} + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker push ${{ github.repository }}:${{ github.event.inputs.tags }} - name: Push Docker image to GitHub Container Registry (GHCR) - run: | - docker push ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }} \ No newline at end of file + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker push ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }} \ No newline at end of file diff --git a/.github/workflows/docker-tag-triggered-prod.yml b/.github/workflows/docker-tag-triggered-prod.yml index 2c1b8bd..437c9c3 100644 --- a/.github/workflows/docker-tag-triggered-prod.yml +++ b/.github/workflows/docker-tag-triggered-prod.yml @@ -12,12 +12,18 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Update runc (temporary fix) # TODO: Remove step when https://github.com/actions/virtual-environments/issues/2658 fixed - run: | - sudo apt-get install libseccomp-dev - git clone https://github.com/opencontainers/runc - cd runc - make - sudo make install + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + sudo apt-get install libseccomp-dev + git clone https://github.com/opencontainers/runc + cd runc + make + sudo make install - name: Login to Docker Hub uses: docker/login-action@v1 with: @@ -30,29 +36,59 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.CR_PAT }} - name: Show Runners environment (debug) - shell: bash - run: export + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + export - name: Identify GitHub tag name - shell: bash - # get tag name from runners environment 'GITHUB_REF' and then use bash substring - # to strip out '+' symbol - required due to gcr not supporting this as a tag - # name (docker hub does support it). - # note if push is NOT triggered by tag then 'GITHUB_REF' will be the branch name. - run: echo "##[set-output name=tag;]$(tag_name=${GITHUB_REF#refs/tags/} && echo "${tag_name//+/-}")" + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + # get tag name from runners environment 'GITHUB_REF' and then use bash substring + # to strip out '+' symbol - required due to gcr not supporting this as a tag + # name (docker hub does support it). + # note if push is NOT triggered by tag then 'GITHUB_REF' will be the branch name. + command: | + echo "##[set-output name=tag;]$(tag_name=${GITHUB_REF#refs/tags/} && echo "${tag_name//+/-}")" id: identify_tag - name: Build Docker image and tag - run: | - docker build \ - --tag ${{ github.repository }}:latest \ - --tag ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ - --tag ghcr.io/${{ github.repository }}:latest \ - --tag ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ - . + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker build \ + --tag ${{ github.repository }}:latest \ + --tag ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ + --tag ghcr.io/${{ github.repository }}:latest \ + --tag ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ + . - name: Push Docker image to Docker Hub - run: | - docker push ${{ github.repository }}:latest - docker push ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker push ${{ github.repository }}:latest + docker push ${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} - name: Push Docker image to GitHub Container Registry (GHCR) - run: | - docker push ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ No newline at end of file + uses: nick-invision/retry@v2.4.0 + with: + timeout_minutes: 60 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + docker push ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ steps.identify_tag.outputs.tag }} \ No newline at end of file