Skip to content

Commit

Permalink
Wrap all tests and docker/build-push-action into nick-fields/retry
Browse files Browse the repository at this point in the history
  • Loading branch information
myoung34 committed Sep 10, 2024
1 parent a7d7128 commit 4ef9714
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 293 deletions.
152 changes: 88 additions & 64 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,31 @@ jobs:
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
- name: Retry build and load
uses: nick-fields/retry@v3
with:
context: .
file: Dockerfile.base.ubuntu-${{ matrix.release }}
pull: true
push: false
load: true
tags: ${{ env.GH_RUNNER_IMAGE }}
platforms: linux/${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
timeout_minutes: 60
max_attempts: 3
command: |
docker buildx build \
--file Dockerfile \
--platform linux/${{ matrix.platform }} \
--tag ${{ env.GH_RUNNER_IMAGE }} \
--load \
--pull \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.
- name: Run goss tests
run: |
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
debian_base_tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -97,24 +104,31 @@ jobs:
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
- name: Retry build
uses: nick-fields/retry@v3
with:
context: .
file: Dockerfile.base.debian-${{ matrix.release }}
pull: true
push: false
load: true
tags: ${{ env.GH_RUNNER_IMAGE }}
platforms: linux/${{ matrix.platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
timeout_minutes: 60
max_attempts: 3
command: |
docker buildx build \
--file Dockerfile.base.debian-${{ matrix.release }} \
--platform linux/${{ matrix.platform }} \
--tag ${{ env.GH_RUNNER_IMAGE }} \
--load \
--pull \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.
- name: Run goss tests
run: |
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
ubuntu_base_latest_deploy:
Expand All @@ -134,18 +148,21 @@ jobs:
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
- name: Retry build and push
uses: nick-fields/retry@v3
with:
context: .
file: Dockerfile.base
pull: true
push: true
tags: ${{ env.ORG }}/github-runner-base:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

timeout_minutes: 60
max_attempts: 3
command: |
docker buildx build \
--file Dockerfile.base \
--platform linux/amd64,linux/arm64 \
--tag ${{ env.ORG }}/github-runner-base:latest \
--push \
--pull \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.
ubuntu_base_deploy:
runs-on: ubuntu-latest
needs: ubuntu_base_tests
Expand All @@ -169,18 +186,21 @@ jobs:
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
- name: Retry build and push
uses: nick-fields/retry@v3
with:
context: .
file: Dockerfile.base.ubuntu-${{ matrix.release }}
pull: true
push: true
tags: ${{ env.ORG }}/github-runner-base:ubuntu-${{ matrix.release }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

timeout_minutes: 60
max_attempts: 3
command: |
docker buildx build \
--file Dockerfile.base.ubuntu-${{ matrix.release }} \
--platform linux/amd64,linux/arm64 \
--tag ${{ env.ORG }}/github-runner-base:ubuntu-${{ matrix.release }} \
--push \
--pull \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.
debian_base_deploy:
runs-on: ubuntu-latest
needs: debian_base_tests
Expand All @@ -204,14 +224,18 @@ jobs:
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
- name: Retry build and push
uses: nick-fields/retry@v3
with:
context: .
file: Dockerfile.base.debian-${{ matrix.release }}
pull: true
push: true
tags: ${{ env.ORG }}/github-runner-base:debian-${{ matrix.release }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
timeout_minutes: 60
max_attempts: 3
command: |
docker buildx build \
--file Dockerfile.base.debian-${{ matrix.release }} \
--platform linux/amd64,linux/arm64 \
--tag ${{ env.ORG }}/github-runner-base:debian-${{ matrix.release }} \
--push \
--pull \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.
Loading

0 comments on commit 4ef9714

Please sign in to comment.