Skip to content

Commit 5924e8d

Browse files
ci: add Consul readiness check to Windows CI jobs
Co-Authored-By: mkeeler@launchdarkly.com <keelerm84@gmail.com>
1 parent d05fccf commit 5924e8d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ jobs:
9797
consul: true
9898
dynamodb: true
9999

100+
- name: Wait for Consul to be ready
101+
run: |
102+
$timeout = 30
103+
$elapsed = 0
104+
while ($elapsed -lt $timeout) {
105+
try {
106+
$response = Invoke-RestMethod -Uri 'http://127.0.0.1:8500/v1/status/leader' -TimeoutSec 2
107+
if ($response -and $response -ne '""') {
108+
Write-Host "Consul is ready (leader: $response)"
109+
exit 0
110+
}
111+
} catch {}
112+
Write-Host "Waiting for Consul to elect a leader... ($elapsed/$timeout seconds)"
113+
Start-Sleep -Seconds 1
114+
$elapsed++
115+
}
116+
Write-Error "Consul did not become ready within $timeout seconds"
117+
exit 1
118+
100119
- name: Install poetry
101120
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
102121

0 commit comments

Comments
 (0)