teqo-backup/.forgejo/workflows/spike-services.yml
2026-08-16 22:43:15 -03:00

39 lines
1.1 KiB
YAML

name: Spike — forgejo-runner v13 node24 actions + gateway
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:
- uses: actions/checkout@v5
- name: Probe gateway
run: |
set -uo pipefail
GW=$(awk '$2 == "00000000" {a=$3; print strtonum("0x" substr(a,7,2)) "." strtonum("0x" substr(a,5,2)) "." strtonum("0x" substr(a,3,2)) "." strtonum("0x" substr(a,1,2)); exit}' /proc/net/route)
echo "gateway=$GW"
for i in $(seq 1 15); do
if (echo > /dev/tcp/"$GW"/5433) 2>/dev/null; then
echo "REACHABLE: gateway:$GW:5433"
exit 0
fi
sleep 2
done
echo "FINAL: gateway $GW:5433 unreachable"
exit 1