mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
fix: complete blue-green deploy test payload and status check (#644)
## Summary - Fix the deploy health check test payload and status value mismatches that prevented blue-green swaps from ever completing - Follow-up to #642 which fixed the error handling / rollback conditions ## Changes - **Missing required fields**: `encode-preview` requires `audio_gcs_path` and `output_gcs_path` but the health check only sent `job_id`, `ass_gcs_path`, and `duration_seconds` (caused HTTP 422). Added a 3-second test audio file and proper output path. - **Status polling mismatch**: Polling checked for `"completed"` but the GCE worker returns `"complete"` — would always time out even on success. - **Submit response mismatch**: Validated against `"completed"` which is never returned — endpoint returns `"accepted"`, `"cached"`, or `"in_progress"`. ## Root Cause The test payload was written based on the plan doc which had an incomplete request schema. The `audio_gcs_path` and `output_gcs_path` fields have been required since the endpoint was first created (PR #200, Jan 2026). The status string mismatch (`"completed"` vs `"complete"`) was likely a typo that was never caught because the request always failed before reaching the polling stage. ## Testing - Previous deploy (#642) confirmed the 422 error and verified rollback now triggers correctly - This fix addresses the payload so the encode test can actually succeed and the swap can complete - Real validation: next deploy after merge @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0464d3edb3
commit
8e2a949a29
2 files changed
+13
-8
No files matched your search
@@ -1186,20 +1186,25 @@ jobs:
|
||||
API_KEY=$(gcloud secrets versions access latest \
|
||||
--secret=encoding-worker-api-key --project=nomadkaraoke)
|
||||
|
||||
DEPLOY_TEST_PATH="gs://karaoke-gen-storage-nomadkaraoke/deploy-test"
|
||||
|
||||
echo "Uploading test assets to GCS..."
|
||||
gsutil cp infrastructure/encoding-worker/test-assets/test-preview.ass \
|
||||
gs://karaoke-gen-storage-nomadkaraoke/deploy-test/test-preview.ass
|
||||
"${DEPLOY_TEST_PATH}/test-preview.ass"
|
||||
gsutil cp infrastructure/encoding-worker/test-assets/test-audio.flac \
|
||||
"${DEPLOY_TEST_PATH}/test-audio.flac"
|
||||
|
||||
echo "Submitting test encode to $SECONDARY_IP..."
|
||||
HTTP_CODE=$(curl -s -o /tmp/encode-response.json -w '%{http_code}' \
|
||||
-X POST "http://${SECONDARY_IP}:8080/encode-preview" \
|
||||
-H "X-API-Key: $API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"job_id": "deploy-health-check",
|
||||
"ass_gcs_path": "gs://karaoke-gen-storage-nomadkaraoke/deploy-test/test-preview.ass",
|
||||
"duration_seconds": 10
|
||||
}') || HTTP_CODE="000"
|
||||
-d "{
|
||||
\"job_id\": \"deploy-health-check\",
|
||||
\"ass_gcs_path\": \"${DEPLOY_TEST_PATH}/test-preview.ass\",
|
||||
\"audio_gcs_path\": \"${DEPLOY_TEST_PATH}/test-audio.flac\",
|
||||
\"output_gcs_path\": \"${DEPLOY_TEST_PATH}/output-preview.mp4\"
|
||||
}") || HTTP_CODE="000"
|
||||
RESPONSE=$(cat /tmp/encode-response.json 2>/dev/null || echo "{}")
|
||||
|
||||
echo "Encode response (HTTP $HTTP_CODE): $RESPONSE"
|
||||
@@ -1211,7 +1216,7 @@ jobs:
|
||||
|
||||
STATUS=$(echo "$RESPONSE" | jq -r '.status // "unknown"')
|
||||
|
||||
if [ "$STATUS" != "accepted" ] && [ "$STATUS" != "completed" ]; then
|
||||
if [ "$STATUS" != "accepted" ] && [ "$STATUS" != "cached" ] && [ "$STATUS" != "in_progress" ]; then
|
||||
echo "::error::Encode test failed with status: $STATUS"
|
||||
echo "passed=false" >> $GITHUB_OUTPUT
|
||||
exit 1
|
||||
@@ -1223,7 +1228,7 @@ jobs:
|
||||
"http://${SECONDARY_IP}:8080/status/deploy-health-check" \
|
||||
-H "X-API-Key: $API_KEY" 2>/dev/null | jq -r '.status // "unknown"' 2>/dev/null) || JOB_STATUS="unknown"
|
||||
echo "Encode status: $JOB_STATUS (attempt $i/12)"
|
||||
if [ "$JOB_STATUS" = "completed" ]; then
|
||||
if [ "$JOB_STATUS" = "complete" ]; then
|
||||
echo "Encode test passed!"
|
||||
echo "passed=true" >> $GITHUB_OUTPUT
|
||||
gsutil rm -f gs://karaoke-gen-storage-nomadkaraoke/deploy-test/** || true
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user