Skip to content

Commit 6b7e278

Browse files
committed
gha: add guardrails timeouts on all jobs
We had a few "runaway jobs" recently, where the job got stuck, and kept running for 6 hours (in one case even 24 hours, probably due some github outage). Some of those jobs could not be terminated. While running these actions on public repositories doesn't cost us, it's still not desirable to have jobs running for that long (as they can still hold up the queue). This patch adds a blanket "2 hours" time-limit to all jobs that didn't have a limit set. We should look at tweaking those limits to actually expected duration, but having a default at least is a start. Also changed the position of some existing timeouts so that we have a consistent order in which it's set; making it easier to spot locations where no limit is defined. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent eacb99d commit 6b7e278

9 files changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/.dco.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
jobs:
2222
run:
2323
runs-on: ubuntu-20.04
24+
timeout-minutes: 120 # guardrails timeout for the whole job
2425
steps:
2526
-
2627
name: Checkout

.github/workflows/.test-prepare.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ on:
2222
jobs:
2323
run:
2424
runs-on: ubuntu-20.04
25+
timeout-minutes: 120 # guardrails timeout for the whole job
2526
outputs:
2627
matrix: ${{ steps.set.outputs.matrix }}
2728
steps:

.github/workflows/.test.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ env:
3434
jobs:
3535
unit:
3636
runs-on: ubuntu-20.04
37+
timeout-minutes: 120 # guardrails timeout for the whole job
3738
continue-on-error: ${{ github.event_name != 'pull_request' }}
38-
timeout-minutes: 120
3939
steps:
4040
-
4141
name: Checkout
@@ -89,8 +89,8 @@ jobs:
8989

9090
unit-report:
9191
runs-on: ubuntu-20.04
92-
continue-on-error: ${{ github.event_name != 'pull_request' }}
9392
timeout-minutes: 10
93+
continue-on-error: ${{ github.event_name != 'pull_request' }}
9494
if: always()
9595
needs:
9696
- unit
@@ -117,8 +117,8 @@ jobs:
117117
118118
docker-py:
119119
runs-on: ubuntu-20.04
120+
timeout-minutes: 120 # guardrails timeout for the whole job
120121
continue-on-error: ${{ github.event_name != 'pull_request' }}
121-
timeout-minutes: 120
122122
steps:
123123
-
124124
name: Checkout
@@ -174,8 +174,8 @@ jobs:
174174

175175
integration-flaky:
176176
runs-on: ubuntu-20.04
177+
timeout-minutes: 120 # guardrails timeout for the whole job
177178
continue-on-error: ${{ github.event_name != 'pull_request' }}
178-
timeout-minutes: 120
179179
steps:
180180
-
181181
name: Checkout
@@ -206,8 +206,8 @@ jobs:
206206

207207
integration:
208208
runs-on: ${{ matrix.os }}
209+
timeout-minutes: 120 # guardrails timeout for the whole job
209210
continue-on-error: ${{ github.event_name != 'pull_request' }}
210-
timeout-minutes: 120
211211
strategy:
212212
fail-fast: false
213213
matrix:
@@ -304,8 +304,8 @@ jobs:
304304

305305
integration-report:
306306
runs-on: ubuntu-20.04
307-
continue-on-error: ${{ github.event_name != 'pull_request' }}
308307
timeout-minutes: 10
308+
continue-on-error: ${{ github.event_name != 'pull_request' }}
309309
if: always()
310310
needs:
311311
- integration
@@ -333,6 +333,7 @@ jobs:
333333
334334
integration-cli-prepare:
335335
runs-on: ubuntu-20.04
336+
timeout-minutes: 120 # guardrails timeout for the whole job
336337
continue-on-error: ${{ github.event_name != 'pull_request' }}
337338
outputs:
338339
matrix: ${{ steps.tests.outputs.matrix }}
@@ -368,8 +369,8 @@ jobs:
368369
369370
integration-cli:
370371
runs-on: ubuntu-20.04
372+
timeout-minutes: 120 # guardrails timeout for the whole job
371373
continue-on-error: ${{ github.event_name != 'pull_request' }}
372-
timeout-minutes: 120
373374
needs:
374375
- integration-cli-prepare
375376
strategy:
@@ -448,8 +449,8 @@ jobs:
448449

449450
integration-cli-report:
450451
runs-on: ubuntu-20.04
451-
continue-on-error: ${{ github.event_name != 'pull_request' }}
452452
timeout-minutes: 10
453+
continue-on-error: ${{ github.event_name != 'pull_request' }}
453454
if: always()
454455
needs:
455456
- integration-cli

.github/workflows/.windows.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ name: .windows
1212
permissions:
1313
contents: read
1414

15+
1516
on:
1617
workflow_call:
1718
inputs:
@@ -42,6 +43,7 @@ env:
4243
jobs:
4344
build:
4445
runs-on: ${{ inputs.os }}
46+
timeout-minutes: 120 # guardrails timeout for the whole job
4547
env:
4648
GOPATH: ${{ github.workspace }}\go
4749
GOBIN: ${{ github.workspace }}\go\bin
@@ -121,7 +123,7 @@ jobs:
121123

122124
unit-test:
123125
runs-on: ${{ inputs.os }}
124-
timeout-minutes: 120
126+
timeout-minutes: 120 # guardrails timeout for the whole job
125127
env:
126128
GOPATH: ${{ github.workspace }}\go
127129
GOBIN: ${{ github.workspace }}\go\bin
@@ -203,6 +205,7 @@ jobs:
203205

204206
unit-test-report:
205207
runs-on: ubuntu-latest
208+
timeout-minutes: 120 # guardrails timeout for the whole job
206209
if: always()
207210
needs:
208211
- unit-test
@@ -229,6 +232,7 @@ jobs:
229232
230233
integration-test-prepare:
231234
runs-on: ubuntu-latest
235+
timeout-minutes: 120 # guardrails timeout for the whole job
232236
outputs:
233237
matrix: ${{ steps.tests.outputs.matrix }}
234238
steps:
@@ -262,8 +266,8 @@ jobs:
262266
263267
integration-test:
264268
runs-on: ${{ inputs.os }}
269+
timeout-minutes: 120 # guardrails timeout for the whole job
265270
continue-on-error: ${{ inputs.storage == 'snapshotter' && github.event_name != 'pull_request' }}
266-
timeout-minutes: 120
267271
needs:
268272
- build
269273
- integration-test-prepare
@@ -522,6 +526,7 @@ jobs:
522526

523527
integration-test-report:
524528
runs-on: ubuntu-latest
529+
timeout-minutes: 120 # guardrails timeout for the whole job
525530
continue-on-error: ${{ inputs.storage == 'snapshotter' && github.event_name != 'pull_request' }}
526531
if: always()
527532
needs:

.github/workflows/bin-image.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141

4242
prepare:
4343
runs-on: ubuntu-20.04
44+
timeout-minutes: 120 # guardrails timeout for the whole job
4445
outputs:
4546
platforms: ${{ steps.platforms.outputs.matrix }}
4647
steps:
@@ -93,6 +94,7 @@ jobs:
9394
9495
build:
9596
runs-on: ubuntu-20.04
97+
timeout-minutes: 120 # guardrails timeout for the whole job
9698
needs:
9799
- validate-dco
98100
- prepare
@@ -167,6 +169,7 @@ jobs:
167169

168170
merge:
169171
runs-on: ubuntu-20.04
172+
timeout-minutes: 120 # guardrails timeout for the whole job
170173
needs:
171174
- build
172175
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && github.event_name != 'pull_request' && github.repository == 'moby/moby'

.github/workflows/buildkit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333

3434
build:
3535
runs-on: ubuntu-20.04
36+
timeout-minutes: 120 # guardrails timeout for the whole job
3637
needs:
3738
- validate-dco
3839
steps:
@@ -62,7 +63,7 @@ jobs:
6263

6364
test:
6465
runs-on: ubuntu-20.04
65-
timeout-minutes: 120
66+
timeout-minutes: 120 # guardrails timeout for the whole job
6667
needs:
6768
- build
6869
env:

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232

3333
build:
3434
runs-on: ubuntu-20.04
35+
timeout-minutes: 120 # guardrails timeout for the whole job
3536
needs:
3637
- validate-dco
3738
strategy:
@@ -69,6 +70,7 @@ jobs:
6970
7071
prepare-cross:
7172
runs-on: ubuntu-latest
73+
timeout-minutes: 120 # guardrails timeout for the whole job
7274
needs:
7375
- validate-dco
7476
outputs:
@@ -90,6 +92,7 @@ jobs:
9092
9193
cross:
9294
runs-on: ubuntu-20.04
95+
timeout-minutes: 120 # guardrails timeout for the whole job
9396
needs:
9497
- validate-dco
9598
- prepare-cross
@@ -133,6 +136,7 @@ jobs:
133136
134137
govulncheck:
135138
runs-on: ubuntu-24.04
139+
timeout-minutes: 120 # guardrails timeout for the whole job
136140
permissions:
137141
# required to write sarif report
138142
security-events: write

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434

3535
build-dev:
3636
runs-on: ubuntu-20.04
37+
timeout-minutes: 120 # guardrails timeout for the whole job
3738
needs:
3839
- validate-dco
3940
strategy:
@@ -86,6 +87,7 @@ jobs:
8687

8788
validate-prepare:
8889
runs-on: ubuntu-20.04
90+
timeout-minutes: 120 # guardrails timeout for the whole job
8991
needs:
9092
- validate-dco
9193
outputs:
@@ -107,7 +109,7 @@ jobs:
107109
108110
validate:
109111
runs-on: ubuntu-20.04
110-
timeout-minutes: 120
112+
timeout-minutes: 120 # guardrails timeout for the whole job
111113
needs:
112114
- validate-prepare
113115
- build-dev
@@ -145,6 +147,7 @@ jobs:
145147
146148
smoke-prepare:
147149
runs-on: ubuntu-20.04
150+
timeout-minutes: 120 # guardrails timeout for the whole job
148151
needs:
149152
- validate-dco
150153
outputs:
@@ -166,6 +169,7 @@ jobs:
166169
167170
smoke:
168171
runs-on: ubuntu-20.04
172+
timeout-minutes: 120 # guardrails timeout for the whole job
169173
needs:
170174
- smoke-prepare
171175
strategy:

.github/workflows/validate-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
jobs:
1717
check-area-label:
1818
runs-on: ubuntu-20.04
19+
timeout-minutes: 120 # guardrails timeout for the whole job
1920
steps:
2021
- name: Missing `area/` label
2122
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
@@ -28,6 +29,7 @@ jobs:
2829
check-changelog:
2930
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/')
3031
runs-on: ubuntu-20.04
32+
timeout-minutes: 120 # guardrails timeout for the whole job
3133
env:
3234
PR_BODY: |
3335
${{ github.event.pull_request.body }}
@@ -56,6 +58,7 @@ jobs:
5658
5759
check-pr-branch:
5860
runs-on: ubuntu-20.04
61+
timeout-minutes: 120 # guardrails timeout for the whole job
5962
env:
6063
PR_TITLE: ${{ github.event.pull_request.title }}
6164
steps:

0 commit comments

Comments
 (0)