diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 90e9b09..dddc3df 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -8006,14 +8006,23 @@ edge_apply() { # stopped containers and check the deployed proxy without recreating them. edge_ssh_args local install_dir="${TF_VAR_edge_install_dir:-${LAB_EDGE_INSTALL_DIR:-/opt/homelab-edge}}" + local edge_server_name="${TF_VAR_server_name:-${LAB_DOMAIN:-}}" if [[ "${install_dir}" == *"'"* ]]; then echo "Invalid edge install directory." >&2 return 1 fi + if [[ ! "${edge_server_name}" =~ ^[a-zA-Z0-9][a-zA-Z0-9.-]*$ ]]; then + echo "A valid edge server hostname is required for the HTTPS health check." >&2 + return 1 + fi ssh "${EDGE_SSH_ARGS[@]}" "${ssh_user}@${ssh_host}" \ "cd '${install_dir}' && sudo docker compose up -d --no-recreate && sudo docker compose exec -T nginx-dev nginx -t && - curl -kfsS --connect-timeout 5 --max-time 10 https://127.0.0.1/edge-health >/dev/null" || return 1 + status=\$(curl --noproxy '*' -kfsS --connect-timeout 5 --max-time 10 \ + --resolve '${edge_server_name}:443:127.0.0.1' \ + -o /dev/null -w '%{http_code}' 'https://${edge_server_name}/edge-health') && + printf 'edge-health=%s\n' \"\$status\" && + test \"\$status\" = 204" || return 1 local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}" if [[ -n "${edge_host}" ]] && declare -F update_duckdns_edge_ip >/dev/null 2>&1; then update_duckdns_edge_ip "${edge_host}"