Infra Ops Hub
Example

bash + curl + jq で DNS 伝播チェック

CI / deploy スクリプトから DNS 変更の伝播を確認する最小の bash サンプル。API キーをINFRA_OPS_HUB_API_KEYに設定して実行します。

#!/usr/bin/env bash
# usage: ./dns-check.sh example.com A
set -euo pipefail

host="${1:?host required}"
type="${2:-A}"
: "${INFRA_OPS_HUB_API_KEY:?INFRA_OPS_HUB_API_KEY is required}"

resp=$(curl -fsSL \
  -H "Authorization: Bearer ${INFRA_OPS_HUB_API_KEY}" \
  "https://infra.yuzlrin.jp/api/v1/dns?host=${host}&type=${type}")
consistent=$(echo "$resp" | jq -r '.consistent')

if [ "$consistent" != "true" ]; then
  echo "[warn] DNS 不整合: $host ($type)"
  echo "$resp" | jq '.resolvers'
  exit 1
fi
echo "[ok] $host ($type) は各 resolver で一致"

exit code を 1 にして deploy 継続前の gate として利用できます。

関連