From cab4878816cc51b7b95f0bc3c5a46bdb4b4e9f51 Mon Sep 17 00:00:00 2001 From: Taleef Date: Wed, 3 Jun 2026 18:31:52 +0500 Subject: [PATCH] fix(deploy): target MIE Container Manager REST API at /api/v1 The MIE Container Manager changed its routing: the origin now serves the SPA web UI (GET /sites returns index.html) and /api serves the Swagger UI, while the JSON REST API moved to /api/v1. The deploy script stripped /api to target the bare origin, so every request returned HTML and the first GET /sites aborted with a non-JSON response, failing the backend deploy. Normalize LAUNCHPAD_API_URL down to the manager origin (stripping any /api, /v1, or /api/v1 suffix) and re-append /api/v1, so the value is resilient to whichever form the secret is stored as. Update the non-JSON error hint to reflect the new origin/Swagger/REST layout. Verified: /api/v1/sites returns application/json; all secret forms normalize to https://manager.os.mieweb.org/api/v1. Co-Authored-By: Claude Opus 4.8 --- .github/scripts/deploy-mieweb-container.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/scripts/deploy-mieweb-container.sh b/.github/scripts/deploy-mieweb-container.sh index eea7f9d..0be4ae5 100755 --- a/.github/scripts/deploy-mieweb-container.sh +++ b/.github/scripts/deploy-mieweb-container.sh @@ -21,13 +21,18 @@ for name in \ require_env "$name" done +# Normalize whatever form LAUNCHPAD_API_URL takes down to the manager origin, then target +# the versioned JSON REST base. As of 2026-06 the MIE Container Manager serves: +# - the SPA web UI at the origin (e.g. GET /sites returns index.html) +# - the Swagger UI at /api +# - the JSON REST API at /api/v1 +# Strip any of these known suffixes if present, then re-append /api/v1 so the value is +# resilient to the secret being stored as the bare origin, /api, /v1, or /api/v1. api_root="${MIEWEB_API_URL%/}" -if [[ "$api_root" == */api ]]; then - # /api is the Swagger UI route; the JSON endpoints are served from the manager origin. - api_base="${api_root%/api}" -else - api_base="$api_root" -fi +api_root="${api_root%/api/v1}" +api_root="${api_root%/v1}" +api_root="${api_root%/api}" +api_base="${api_root}/api/v1" request() { local method="$1" @@ -72,7 +77,7 @@ request() { if ! jq -e . "$response_file" >/dev/null 2>&1; then echo "::error::${method} ${path} returned a non-JSON response from ${api_base}${path}." >&2 - echo "::error::Check LAUNCHPAD_API_URL. The Swagger UI lives at /api, but REST requests must target the manager origin." >&2 + echo "::error::Check LAUNCHPAD_API_URL. The web UI serves HTML at the origin and Swagger at /api; the JSON REST API is at /api/v1." >&2 echo "Response preview:" >&2 head -c 500 "$response_file" >&2 || true echo >&2