feat: 清理openspec
This commit is contained in:
@@ -647,15 +647,15 @@ launch_generated_run() {
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_generated_run_registration_and_heartbeat() {
|
||||
wait_for_generated_run_heartbeat() {
|
||||
local registration_file="$WORK_DIR/generated-run-registration.response.json"
|
||||
local heartbeat_file="$WORK_DIR/generated-run-heartbeat.response.json"
|
||||
local first_heartbeat=""
|
||||
rm -f "$registration_file" "$heartbeat_file"
|
||||
printf 'waiting for generated Run endpoint %s registration\n' "$GENERATED_RUN_ENDPOINT_ID"
|
||||
printf 'waiting for generated Run heartbeat %s\n' "$GENERATED_RUN_ENDPOINT_ID"
|
||||
for _ in $(seq 1 45); do
|
||||
if [[ -f "$GENERATED_RUN_PID_FILE" ]] && ! kill -0 "$(<"$GENERATED_RUN_PID_FILE")" 2>/dev/null; then
|
||||
printf 'generated Run exited before registration; see %s\n' "$GENERATED_RUN_LOG" >&2
|
||||
printf 'generated Run exited before heartbeat; see %s\n' "$GENERATED_RUN_LOG" >&2
|
||||
return 1
|
||||
fi
|
||||
if json_get "$API_URL/run/endpoints/$GENERATED_RUN_ENDPOINT_ID" "$registration_file" "${AUTH_HEADER[@]}" 2>/dev/null; then
|
||||
@@ -677,13 +677,13 @@ NODE
|
||||
sleep 1
|
||||
done
|
||||
if [[ -z "$first_heartbeat" ]]; then
|
||||
printf 'generated Run endpoint %s did not register with a safe capability report\n' "$GENERATED_RUN_ENDPOINT_ID" >&2
|
||||
printf 'generated Run endpoint %s did not report a safe heartbeat\n' "$GENERATED_RUN_ENDPOINT_ID" >&2
|
||||
[[ -f "$GENERATED_RUN_LOG" ]] && sed -n '1,160p' "$GENERATED_RUN_LOG" >&2
|
||||
return 1
|
||||
fi
|
||||
reject_forbidden_fragments "$registration_file"
|
||||
|
||||
printf 'waiting for generated Run endpoint %s heartbeat\n' "$GENERATED_RUN_ENDPOINT_ID"
|
||||
printf 'waiting for a subsequent generated Run heartbeat %s\n' "$GENERATED_RUN_ENDPOINT_ID"
|
||||
for _ in $(seq 1 45); do
|
||||
if json_get "$API_URL/run/endpoints/$GENERATED_RUN_ENDPOINT_ID" "$heartbeat_file" "${AUTH_HEADER[@]}" 2>/dev/null && node - "$heartbeat_file" "$GENERATED_RUN_ENDPOINT_ID" "$first_heartbeat" <<'NODE'
|
||||
const fs = require("fs");
|
||||
@@ -700,7 +700,7 @@ NODE
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
printf 'generated Run endpoint %s did not report a subsequent heartbeat\n' "$GENERATED_RUN_ENDPOINT_ID" >&2
|
||||
printf 'generated Run %s did not report a subsequent heartbeat\n' "$GENERATED_RUN_ENDPOINT_ID" >&2
|
||||
[[ -f "$GENERATED_RUN_LOG" ]] && sed -n '1,160p' "$GENERATED_RUN_LOG" >&2
|
||||
return 1
|
||||
}
|
||||
@@ -1159,9 +1159,7 @@ JSON
|
||||
|
||||
cat >"$WORK_DIR/log-session-deployment.request.json" <<JSON
|
||||
{
|
||||
"runEndpointId": "$RUN_ENDPOINT_ID",
|
||||
"mode": "existing-server",
|
||||
"profileKey": "run-local",
|
||||
"createInputs": {},
|
||||
"serverRoot": "/srv/local-debug/$LOG_SESSION_SERVER_ID"
|
||||
}
|
||||
@@ -1413,19 +1411,17 @@ reject_forbidden_fragments "$WORK_DIR/server-run-build-job.response.json"
|
||||
reject_forbidden_fragments "$WORK_DIR/server-run-build-artifact.response.json"
|
||||
read_latest_run_download_content "$SERVER_ID" "$WORK_DIR/server-run-download.response.json" "$WORK_DIR/server-run-download-content.bin" "$WORK_DIR/server-run-download-chunks"
|
||||
launch_generated_run "$WORK_DIR/server-run-download-content.bin"
|
||||
wait_for_generated_run_registration_and_heartbeat
|
||||
wait_for_generated_run_heartbeat
|
||||
|
||||
cat >"$WORK_DIR/server-deployment.request.json" <<JSON
|
||||
{
|
||||
"runEndpointId": "$GENERATED_RUN_ENDPOINT_ID",
|
||||
"mode": "custom-command",
|
||||
"profileKey": "run-local",
|
||||
"createInputs": {},
|
||||
"serverRoot": "$RUN_WORKSPACE_ROOT/$SERVER_ID",
|
||||
"startCommand": "/usr/bin/true"
|
||||
}
|
||||
JSON
|
||||
printf 'saving optional deployment settings after generated Run registration\n'
|
||||
printf 'saving optional deployment settings after generated Run heartbeat\n'
|
||||
curl -fsS -X PUT -H 'Content-Type: application/json' "${AUTH_HEADER[@]}" \
|
||||
--data-binary "@$WORK_DIR/server-deployment.request.json" \
|
||||
"$API_URL/server-instances/$SERVER_ID/deployment" >"$WORK_DIR/server-deployment.response.json"
|
||||
|
||||
Reference in New Issue
Block a user