Files
probably-rendering-one-more…/scripts/verify-studio-production.sh
T
codex-bot 06999cd8a6
studio CI and deployment / verify-and-deploy (pull_request) Successful in 3m25s
Keep recurring acceptance cleanup scoped to each test run
2026-10-28 17:37:46 +08:00

40 lines
1.9 KiB
Bash

#!/usr/bin/env bash
# Run on ces-control after deployment; never starts a preview web server.
set -Eeuo pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
RESULT_DIR="$REPO_ROOT/artifacts/studio-acceptance"
MODE=${1:-verify}
[[ "$MODE" == verify || "$MODE" == --diagnose ]] || exit 2
WIKI_IMAGE=$(docker inspect --format '{{.Config.Image}}' prompt-waterfall-wiki-1)
[[ "$WIKI_IMAGE" =~ ^waterfall-wiki:[0-9a-f]{40}$ ]] || { echo 'Unexpected Wiki image'; exit 1; }
TEST_IMAGE="waterfall-wiki-tests:${WIKI_IMAGE#waterfall-wiki:}"
docker image inspect "$TEST_IMAGE" >/dev/null
mkdir -p "$RESULT_DIR"
chown 1000:1000 "$RESULT_DIR"
run_api(){
local result_root=$1 script=$2; shift 2
docker run --rm --volumes-from prompt-waterfall-wiki-1:ro \
--mount "type=bind,src=$REPO_ROOT,dst=/delivery,readonly" \
--mount "type=bind,src=$result_root,dst=/tmp/studio-library" \
-e AUTH_CONFIG_FILE=/auth/config.json -e AUTH_CHECK_BASE_URL=http://8.211.154.134:18131 \
--entrypoint node "$TEST_IMAGE" dist/auth-cli.cjs run "/delivery/scripts/$script" "$@"
}
# Result files are uploaded by the workflow and removed after successful upload.
printf '{"temporaryOutputManagedByCI":true}\n' > "$RESULT_DIR/cleanup.json"
# Always archive only the UUIDs created by this run, including when visual checks fail.
finish(){
local status=$?
trap - EXIT
if [[ -f "$RESULT_DIR/verification.json" ]]; then
if ! run_api "$RESULT_DIR" verify-studio-library.mjs --finalize; then status=1; fi
fi
exit "$status"
}
trap finish EXIT
run_api "$RESULT_DIR" verify-studio-library.mjs
docker run --rm --volumes-from prompt-waterfall-wiki-1:ro \
--mount "type=bind,src=$REPO_ROOT,dst=/delivery,readonly" \
--mount "type=bind,src=$RESULT_DIR,dst=/tmp/studio-library" \
-e AUTH_CONFIG_FILE=/auth/config.json -e NODE_PATH=/app/node_modules \
--entrypoint node "$TEST_IMAGE" /delivery/scripts/verify-studio-visual.cjs "$MODE"