Skip to content

Commit

Permalink
update workflow with retry action
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Apr 21, 2021
1 parent 1167284 commit c796e4a
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 44 deletions.
64 changes: 47 additions & 17 deletions .github/workflows/docker-manual-triggered-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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:
Expand All @@ -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/[email protected]
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/[email protected]
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/[email protected]
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 }}
uses: nick-invision/[email protected]
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 }}
90 changes: 63 additions & 27 deletions .github/workflows/docker-tag-triggered-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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:
Expand All @@ -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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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 }}
uses: nick-invision/[email protected]
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 }}

0 comments on commit c796e4a

Please sign in to comment.