Fix local run freshness and plugin asset handling
This commit is contained in:
@@ -378,6 +378,23 @@ create_server_workflow() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
create_server_instance() {
|
||||
local label="$1"
|
||||
local server_id="$2"
|
||||
local request_file="$3"
|
||||
local response_file="$4"
|
||||
if json_post "$API_URL/server-instances" "$request_file" "$response_file" "${AUTH_HEADER[@]}"; then
|
||||
return 0
|
||||
fi
|
||||
if [[ -s "$response_file" ]] && response_code_is_duplicate "$response_file"; then
|
||||
json_get "$API_URL/server-instances/$server_id" "$response_file" "${AUTH_HEADER[@]}"
|
||||
return 0
|
||||
fi
|
||||
printf '%s server creation failed; platform response:\n' "$label" >&2
|
||||
sed -n '1,160p' "$response_file" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_file_contains() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
@@ -970,9 +987,14 @@ function readAssetFiles(manifest) {
|
||||
return (manifest.assetFiles ?? []).map((file) => ({
|
||||
path: file.path,
|
||||
mode: file.mode,
|
||||
content: fs.readFileSync(path.join(manifestDir, file.path), "utf8")
|
||||
...readAssetFileContent(path.join(manifestDir, file.path), file.path)
|
||||
}));
|
||||
}
|
||||
function readAssetFileContent(assetPath, logicalPath) {
|
||||
const body = fs.readFileSync(assetPath);
|
||||
if (/\.(?:json|cmd|sh|sql|txt|ya?ml)$/i.test(logicalPath)) return { content: body.toString("utf8") };
|
||||
return { content: body.toString("base64"), encoding: "base64" };
|
||||
}
|
||||
const manifest = {
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
@@ -1046,9 +1068,14 @@ function readAssetFiles(manifest) {
|
||||
return (manifest.assetFiles ?? []).map((file) => ({
|
||||
path: file.path,
|
||||
mode: file.mode,
|
||||
content: fs.readFileSync(path.join(manifestDir, file.path), "utf8")
|
||||
...readAssetFileContent(path.join(manifestDir, file.path), file.path)
|
||||
}));
|
||||
}
|
||||
function readAssetFileContent(assetPath, logicalPath) {
|
||||
const body = fs.readFileSync(assetPath);
|
||||
if (/\.(?:json|cmd|sh|sql|txt|ya?ml)$/i.test(logicalPath)) return { content: body.toString("utf8") };
|
||||
return { content: body.toString("base64"), encoding: "base64" };
|
||||
}
|
||||
const localRunCapabilities = [
|
||||
"process.install",
|
||||
"process.start",
|
||||
@@ -1149,8 +1176,8 @@ cat >"$WORK_DIR/create-log-session-server.request.json" <<JSON
|
||||
{
|
||||
"id": "$LOG_SESSION_SERVER_ID",
|
||||
"pluginId": "game.example",
|
||||
"name": "Current Log Session Smoke $SMOKE_INVOCATION_ID",
|
||||
"idempotencyKey": "local-debug-log-session-create-$SMOKE_INVOCATION_ID"
|
||||
"runEndpointId": "$RUN_ENDPOINT_ID",
|
||||
"name": "Current Log Session Smoke $SMOKE_INVOCATION_ID"
|
||||
}
|
||||
JSON
|
||||
|
||||
@@ -1224,7 +1251,7 @@ create_server_workflow "dev" "$SERVER_LOCAL_ID" "$WORK_DIR/create-server.request
|
||||
reject_forbidden_fragments "$WORK_DIR/create-server.response.json"
|
||||
|
||||
printf 'creating current supervised log session fixture server\n'
|
||||
create_server_workflow "log session fixture" "$LOG_SESSION_SERVER_ID" "$WORK_DIR/create-log-session-server.request.json" "$WORK_DIR/create-log-session-server.response.json"
|
||||
create_server_instance "log session fixture" "$LOG_SESSION_SERVER_ID" "$WORK_DIR/create-log-session-server.request.json" "$WORK_DIR/create-log-session-server.response.json"
|
||||
reject_forbidden_fragments "$WORK_DIR/create-log-session-server.response.json"
|
||||
|
||||
printf 'creating SCUM server lifecycle workflows through platform API\n'
|
||||
|
||||
Reference in New Issue
Block a user