Skip to content

Commit c54340d

Browse files
authored
Merge pull request #394 from myoung34/retry_buildx
Wrap all tests and docker/build-push-action into nick-fields/retry
2 parents a7d7128 + 4ef9714 commit c54340d

4 files changed

Lines changed: 372 additions & 293 deletions

File tree

.github/workflows/base.yml

Lines changed: 88 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,31 @@ jobs:
4545
with:
4646
username: ${{ secrets.DOCKER_USER }}
4747
password: ${{ secrets.DOCKER_TOKEN }}
48-
- name: Build
49-
uses: docker/build-push-action@v6
48+
- name: Retry build and load
49+
uses: nick-fields/retry@v3
5050
with:
51-
context: .
52-
file: Dockerfile.base.ubuntu-${{ matrix.release }}
53-
pull: true
54-
push: false
55-
load: true
56-
tags: ${{ env.GH_RUNNER_IMAGE }}
57-
platforms: linux/${{ matrix.platform }}
58-
cache-from: type=gha
59-
cache-to: type=gha,mode=max
51+
timeout_minutes: 60
52+
max_attempts: 3
53+
command: |
54+
docker buildx build \
55+
--file Dockerfile \
56+
--platform linux/${{ matrix.platform }} \
57+
--tag ${{ env.GH_RUNNER_IMAGE }} \
58+
--load \
59+
--pull \
60+
--cache-from type=gha \
61+
--cache-to type=gha,mode=max \
62+
.
6063
- name: Run goss tests
61-
run: |
62-
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
63-
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
64-
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
65-
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
64+
uses: nick-fields/retry@v3
65+
with:
66+
timeout_minutes: 60
67+
max_attempts: 3
68+
command: |
69+
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
70+
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
71+
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
72+
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
6673
6774
debian_base_tests:
6875
runs-on: ubuntu-latest
@@ -97,24 +104,31 @@ jobs:
97104
with:
98105
username: ${{ secrets.DOCKER_USER }}
99106
password: ${{ secrets.DOCKER_TOKEN }}
100-
- name: Build
101-
uses: docker/build-push-action@v6
107+
- name: Retry build
108+
uses: nick-fields/retry@v3
102109
with:
103-
context: .
104-
file: Dockerfile.base.debian-${{ matrix.release }}
105-
pull: true
106-
push: false
107-
load: true
108-
tags: ${{ env.GH_RUNNER_IMAGE }}
109-
platforms: linux/${{ matrix.platform }}
110-
cache-from: type=gha
111-
cache-to: type=gha,mode=max
110+
timeout_minutes: 60
111+
max_attempts: 3
112+
command: |
113+
docker buildx build \
114+
--file Dockerfile.base.debian-${{ matrix.release }} \
115+
--platform linux/${{ matrix.platform }} \
116+
--tag ${{ env.GH_RUNNER_IMAGE }} \
117+
--load \
118+
--pull \
119+
--cache-from type=gha \
120+
--cache-to type=gha,mode=max \
121+
.
112122
- name: Run goss tests
113-
run: |
114-
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
115-
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
116-
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
117-
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
123+
uses: nick-fields/retry@v3
124+
with:
125+
timeout_minutes: 60
126+
max_attempts: 3
127+
command: |
128+
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
129+
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
130+
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
131+
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
118132
119133
120134
ubuntu_base_latest_deploy:
@@ -134,18 +148,21 @@ jobs:
134148
with:
135149
username: ${{ secrets.DOCKER_USER }}
136150
password: ${{ secrets.DOCKER_TOKEN }}
137-
- name: Build and push
138-
uses: docker/build-push-action@v6
151+
- name: Retry build and push
152+
uses: nick-fields/retry@v3
139153
with:
140-
context: .
141-
file: Dockerfile.base
142-
pull: true
143-
push: true
144-
tags: ${{ env.ORG }}/github-runner-base:latest
145-
platforms: linux/amd64,linux/arm64
146-
cache-from: type=gha
147-
cache-to: type=gha,mode=max
148-
154+
timeout_minutes: 60
155+
max_attempts: 3
156+
command: |
157+
docker buildx build \
158+
--file Dockerfile.base \
159+
--platform linux/amd64,linux/arm64 \
160+
--tag ${{ env.ORG }}/github-runner-base:latest \
161+
--push \
162+
--pull \
163+
--cache-from type=gha \
164+
--cache-to type=gha,mode=max \
165+
.
149166
ubuntu_base_deploy:
150167
runs-on: ubuntu-latest
151168
needs: ubuntu_base_tests
@@ -169,18 +186,21 @@ jobs:
169186
with:
170187
username: ${{ secrets.DOCKER_USER }}
171188
password: ${{ secrets.DOCKER_TOKEN }}
172-
- name: Build and push
173-
uses: docker/build-push-action@v6
189+
- name: Retry build and push
190+
uses: nick-fields/retry@v3
174191
with:
175-
context: .
176-
file: Dockerfile.base.ubuntu-${{ matrix.release }}
177-
pull: true
178-
push: true
179-
tags: ${{ env.ORG }}/github-runner-base:ubuntu-${{ matrix.release }}
180-
platforms: linux/amd64,linux/arm64
181-
cache-from: type=gha
182-
cache-to: type=gha,mode=max
183-
192+
timeout_minutes: 60
193+
max_attempts: 3
194+
command: |
195+
docker buildx build \
196+
--file Dockerfile.base.ubuntu-${{ matrix.release }} \
197+
--platform linux/amd64,linux/arm64 \
198+
--tag ${{ env.ORG }}/github-runner-base:ubuntu-${{ matrix.release }} \
199+
--push \
200+
--pull \
201+
--cache-from type=gha \
202+
--cache-to type=gha,mode=max \
203+
.
184204
debian_base_deploy:
185205
runs-on: ubuntu-latest
186206
needs: debian_base_tests
@@ -204,14 +224,18 @@ jobs:
204224
with:
205225
username: ${{ secrets.DOCKER_USER }}
206226
password: ${{ secrets.DOCKER_TOKEN }}
207-
- name: Build and push
208-
uses: docker/build-push-action@v6
227+
- name: Retry build and push
228+
uses: nick-fields/retry@v3
209229
with:
210-
context: .
211-
file: Dockerfile.base.debian-${{ matrix.release }}
212-
pull: true
213-
push: true
214-
tags: ${{ env.ORG }}/github-runner-base:debian-${{ matrix.release }}
215-
platforms: linux/amd64,linux/arm64
216-
cache-from: type=gha
217-
cache-to: type=gha,mode=max
230+
timeout_minutes: 60
231+
max_attempts: 3
232+
command: |
233+
docker buildx build \
234+
--file Dockerfile.base.debian-${{ matrix.release }} \
235+
--platform linux/amd64,linux/arm64 \
236+
--tag ${{ env.ORG }}/github-runner-base:debian-${{ matrix.release }} \
237+
--push \
238+
--pull \
239+
--cache-from type=gha \
240+
--cache-to type=gha,mode=max \
241+
.

0 commit comments

Comments
 (0)