Skip to content

Commit c3d8ba0

Browse files
authored
ci: populate missing job timeout-minutes, fail build if missing (#15373)
Ensure all workflow jobs have explicit `timeout-minutes` set
1 parent e270706 commit c3d8ba0

File tree

10 files changed

+86
-2
lines changed

10 files changed

+86
-2
lines changed

.github/workflows/actions.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
actionlint:
2121
name: Run actionlint
2222
runs-on: ubuntu-latest
23+
timeout-minutes: 15
2324
steps:
2425
- name: Checkout repository
2526
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -32,6 +33,7 @@ jobs:
3233
zizmor:
3334
name: Run zizmor
3435
runs-on: ubuntu-latest
36+
timeout-minutes: 15
3537
permissions:
3638
security-events: write # integration with github advanced security
3739
steps:

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
name: Analyze (${{ matrix.language }})
1919
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2020
runs-on: ubuntu-24.04
21+
timeout-minutes: 15
2122
permissions:
2223
security-events: write # integrate with Github Advanced Security
2324

.github/workflows/dependency-submission.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
dependency-submission:
1616
name: Submit gradle dependencies
1717
runs-on: ubuntu-latest
18+
timeout-minutes: 15
1819
permissions:
1920
contents: write # see action's documentation
2021
steps:

.github/workflows/label-pull-request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
pull-requests: write # manipulate existing labels
2727

2828
runs-on: ubuntu-latest
29+
timeout-minutes: 15
2930

3031
steps:
3132
- name: Run Labeler action

.github/workflows/mark-stale-PRs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
pull-requests: write # must comment/label PRs
2222
actions: write # must manipulate actions cache to split workload across multiple runs
2323

24+
timeout-minutes: 15
25+
2426
steps:
2527
- name: Run stale PR action
2628
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0

.github/workflows/run-nightly-smoketester.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
java-version: [ '25' ]
2626

2727
runs-on: ${{ matrix.os }}
28+
timeout-minutes: 30
2829

2930
env:
3031
LUCENE_RELEASE_DIR: /tmp/lucene-release-dir

.github/workflows/verify-changelog-and-set-milestone.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions: {}
88
jobs:
99
changelog-verifier-and-milestone-setter:
1010
name: Verify Change Log Entry and Set Milestone
11+
timeout-minutes: 15
1112
runs-on: ubuntu-latest
1213
if: github.event.pull_request.draft == false
1314
permissions:

build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/astgrep/AstGrepPlugin.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,16 @@ public void apply(Project project) {
7070
}
7171

7272
var args = new ArrayList<String>();
73-
// fail on any rule match regardless of severity level
73+
// fail on any rule match regardless of severity level. Scan hidden files/directories
74+
// too.
7475
args.addAll(
75-
List.of("scan", "-c", "gradle/validation/ast-grep/sgconfig.yml", "--error"));
76+
List.of(
77+
"scan",
78+
"-c",
79+
"gradle/validation/ast-grep/sgconfig.yml",
80+
"--error",
81+
"--no-ignore",
82+
"hidden"));
7683
// use the github format when being run as a workflow
7784
if (System.getenv("CI") != null && System.getenv("GITHUB_WORKFLOW") != null) {
7885
args.addAll(List.of("--format", "github"));
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Checks for github actions
2+
---
3+
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/refs/heads/main/schemas/yaml_rule.json
4+
id: missing-job-timeout
5+
language: yaml
6+
files:
7+
- ".github/workflows/**.yml"
8+
rule:
9+
kind: block_mapping_pair
10+
all:
11+
- has:
12+
kind: flow_node
13+
field: key
14+
pattern: $JOBNAME
15+
- has:
16+
kind: block_node
17+
field: value
18+
has:
19+
kind: block_mapping
20+
# doesn't have timeout minutes
21+
not:
22+
has:
23+
kind: block_mapping_pair
24+
has:
25+
field: key
26+
kind: flow_node
27+
has:
28+
pattern: timeout-minutes
29+
stopBy: end
30+
inside:
31+
kind: block_mapping
32+
inside:
33+
kind: block_node
34+
inside:
35+
# top-level "jobs:"
36+
kind: block_mapping_pair
37+
inside:
38+
kind: block_mapping
39+
inside:
40+
kind: block_node
41+
inside:
42+
kind: document
43+
has:
44+
field: key
45+
kind: flow_node
46+
has:
47+
pattern: jobs
48+
stopBy: end
49+
severity: error
50+
message: workflow job `$JOBNAME` missing `timeout-minutes:`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
id: missing-job-timeout
3+
invalid:
4+
- |
5+
jobs:
6+
foobar:
7+
runs-on: supercomputer
8+
valid:
9+
- |
10+
jobs:
11+
foobar:
12+
runs-on: supercomputer
13+
timeout-minutes: 30
14+
- |
15+
somethingelse:
16+
jobs:
17+
foobar:
18+
unrelated: stuff

0 commit comments

Comments
 (0)