Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions actions/persistent-stores/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,34 @@ runs:
# 1.20.1 until they fix the issue
run: |
choco install consul --version=1.20.1

# The chocolatey package registers Consul as a Windows service which
# races with the dev agent for port binding. Stop and disable it.
Stop-Service consul -ErrorAction SilentlyContinue
Set-Service consul -StartupType Disabled -ErrorAction SilentlyContinue

Start-Process consul -ArgumentList 'agent', '-dev', '-http-port=${{ inputs.consul_port }}'

# Wait for the dev agent to complete Raft leader election.
$timeout = 30
$elapsed = 0
while ($elapsed -lt $timeout) {
try {
$response = Invoke-RestMethod -Uri 'http://127.0.0.1:${{ inputs.consul_port }}/v1/status/leader' -TimeoutSec 2
if ($response -and $response -ne '""') {
Write-Host "Consul is ready (leader: $response)"
break
}
} catch {}
Write-Host "Waiting for Consul to elect a leader... ($elapsed/$timeout seconds)"
Start-Sleep -Seconds 1
$elapsed++
}
if ($elapsed -eq $timeout) {
Write-Error "Consul did not become ready within $timeout seconds"
exit 1
}

- name: "DynamoDB for Windows"
shell: powershell
if: ${{ inputs.dynamodb == 'true' && runner.os == 'Windows' }}
Expand Down