name: Spike — service postgres em porta própria on: push: branches: [OPS50-spike-services] jobs: probe: runs-on: ubuntu-latest services: postgres: image: postgres:17-alpine env: POSTGRES_USER: teqo POSTGRES_PASSWORD: teqo POSTGRES_DB: teqo_test ports: - 5433:5432 options: >- --health-cmd "pg_isready -U teqo" --health-interval 5s --health-timeout 5s --health-retries 12 steps: - name: Probe aliases v2 run: | set -uo pipefail for target in postgres:5432 localhost:5433 127.0.0.1:5433; do host="${target%:*}" port="${target#*:}" if (echo > /dev/tcp/"$host"/"$port") 2>/dev/null; then echo "REACHABLE: $target" else echo "unreachable: $target" fi done if (echo > /dev/tcp/postgres/5432) 2>/dev/null; then echo "FINAL: postgres:5432 OK" else echo "FINAL: nada alcançável" exit 1 fi