Skip to content

fix: Restore HTTP readiness poll for Consul on Windows#92

Merged
keelerm84 merged 1 commit into
mainfrom
mk/restore-consul-http-readiness-check
Jun 8, 2026
Merged

fix: Restore HTTP readiness poll for Consul on Windows#92
keelerm84 merged 1 commit into
mainfrom
mk/restore-consul-http-readiness-check

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

The consul members readiness check introduced in #77 fails the Windows step on its first loop iteration, so this restores the previous HTTP readiness poll.

Root cause

While the dev agent is still starting, consul members writes a connection-refused message to stderr:

consul : Error retrieving members: Get "http://127.0.0.1:8500/v1/agent/members...": dial tcp 127.0.0.1:8500: ...actively refused it
    + FullyQualifiedErrorId : NativeCommandError
##[error]Process completed with exit code 1.

The 2>&1 merge under the Actions PowerShell wrapper (which runs with $ErrorActionPreference = 'Stop') turns that native-command stderr into a terminating NativeCommandError, killing the step on the very first iteration -- the retry loop never runs, and there was no try/catch to absorb it.

Fix

Restore the /v1/status/leader HTTP poll. Invoke-RestMethod raises a catchable exception on connection-refused, which the try/catch swallows so the loop retries until the agent is ready (30s timeout, fail on timeout). This reverts only that last change to the Consul-for-Windows step; the /noservice install change from #77 is left intact.

Observed in python-server-sdk#412 CI.

The consul members readiness check from #77 fails the step on its first
iteration. While Consul is still starting, consul members writes a
connection-refused message to stderr; the 2>&1 merge under the Actions
PowerShell wrapper ($ErrorActionPreference=Stop) surfaces that as a
NativeCommandError and terminates the step before the retry loop can run.

Restore the previous /v1/status/leader HTTP poll, where Invoke-RestMethod
raises a catchable exception that the try/catch swallows so the loop
retries until the agent is ready. The /noservice install change from #77
is unaffected.
@keelerm84 keelerm84 force-pushed the mk/restore-consul-http-readiness-check branch from 5de73a0 to 349ec8d Compare June 8, 2026 14:51
@keelerm84 keelerm84 marked this pull request as ready for review June 8, 2026 14:59
@keelerm84 keelerm84 requested a review from a team as a code owner June 8, 2026 14:59
@keelerm84 keelerm84 merged commit 0a5a29e into main Jun 8, 2026
2 checks passed
@keelerm84 keelerm84 deleted the mk/restore-consul-http-readiness-check branch June 8, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants