Commit 952ecf2
authored
fix(wait-for-grafana): two-phase polling with smarter timeout handling (#213)
* fix(wait-for-grafana): two-phase polling with smarter timeout handling
Split the polling loop into two phases:
1. TCP-bind phase (new `startupTimeout` input, default 300s): polls every
5s while curl returns 000 (ECONNREFUSED). Grafana 13 and dev-preview
images on contested runners can take >60s to bind the port; the old
single-phase timeout would fail the job before the process was ready.
2. Health phase (existing `timeout` input, default 60s): once the port
responds with anything other than 000, switches to fast polling
(existing `interval`, default 0.5s) until the expected status code
is received.
Additional improvements:
- Fail fast on 4xx responses in the health phase — these indicate a URL
misconfiguration rather than a timing issue and won't self-resolve.
- Pass --connect-timeout 2 to curl in phase 1 so each attempt doesn't
hang waiting for a connection that will never come.
Backward compatible: callers that don't pass `startupTimeout` get the
300s default, which is strictly better than the previous 60s limit.
* babysit: address Copilot review feedback
- Default startup_timeout to 300 if 5th arg is absent, preventing
immediate Phase 1 exit when called with the old 4-arg interface
- Distinguish ECONNREFUSED (curl exit 7) from other 000-producing
errors (DNS failure = exit 6, TLS errors, etc.); fail fast on
anything that isn't exit 7, avoiding a 300s stall on misconfigured URLs
- Add --connect-timeout 2 and --max-time 10 to Phase 2 curl calls
so a stalled connection cannot outlast the health timeout window
* babysit: document startupTimeout input in README
* babysit: remove version-specific language from docs
000 failures confirmed on grafana-enterprise@12.3.6, not just v13 or
dev-preview images -- the issue is pure runner contention, not image
version. Update action.yml description and README to reflect this.1 parent 4698961 commit 952ecf2
3 files changed
Lines changed: 61 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | | - | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | | - | |
16 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
17 | 54 | | |
18 | 55 | | |
19 | 56 | | |
20 | 57 | | |
21 | 58 | | |
22 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
23 | 65 | | |
24 | 66 | | |
25 | 67 | | |
26 | 68 | | |
27 | | - | |
| 69 | + | |
28 | 70 | | |
0 commit comments