Skip to content

Commit de67461

Browse files
Fix preview deploy: use appData endpoint, not appDefinitions/update
appDefinitions/update silently ignores a top-level imageName field, so the "deploy" step was reporting success while never actually swapping the running image — the app stayed on CapRover's placeholder page. Deploying a pre-built image goes through appData with a captainDefinitionContent payload instead, same as the caprover CLI does internally. Also required a ghcr.io registry credential in CapRover (GHCR_PULL_PAT secret) since the preview image package is private and the node had no credentials to pull it — confirmed via a manual deploy against pr-136 that this now serves real routes (/events, /talk, etc.) instead of 404ing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W2kALmabEHRhY4yGKRKykv
1 parent 31ff743 commit de67461

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎.github/workflows/preview.yml‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,20 @@ jobs:
8686
-H "x-captain-auth: $ADMIN_TOKEN" \
8787
-d "{\"appName\": \"$APP_NAME\"}" || true
8888
89-
# Point app at the pre-built image and trigger deploy
9089
curl -sf -X POST "$CAPROVER_URL/api/v2/user/apps/appDefinitions/update" \
9190
-H "Content-Type: application/json" \
9291
-H "x-captain-auth: $ADMIN_TOKEN" \
93-
-d "{\"appName\": \"$APP_NAME\", \"imageName\": \"$IMAGE\", \"instanceCount\": 1}"
92+
-d "{\"appName\": \"$APP_NAME\", \"instanceCount\": 1}"
93+
94+
# Deploying a pre-built image is NOT done via appDefinitions/update's
95+
# imageName field (that field is silently ignored) — it goes through
96+
# appData with a captainDefinitionContent payload, same as the CLI.
97+
CAPTAIN_DEF=$(jq -nc --arg img "$IMAGE" '{"schemaVersion":2,"imageName":$img}')
98+
BODY=$(jq -nc --arg def "$CAPTAIN_DEF" '{"captainDefinitionContent":$def,"gitHash":""}')
99+
curl -sf -X POST "$CAPROVER_URL/api/v2/user/apps/appData/$APP_NAME" \
100+
-H "Content-Type: application/json" \
101+
-H "x-captain-auth: $ADMIN_TOKEN" \
102+
-d "$BODY"
94103
95104
- name: Comment preview URL on PR
96105
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7

0 commit comments

Comments
 (0)