forked from baron/baron-sso
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -307,8 +307,24 @@ build_allowed_return_urls() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_userfront_return_urls() {
|
||||
local base="$1"
|
||||
local normalized
|
||||
normalized="$(canonicalize_url "$base")"
|
||||
[[ -n "$normalized" ]] || return
|
||||
|
||||
add_allowed_with_slash_variant "$normalized"
|
||||
add_allowed_url "${normalized}/ko"
|
||||
add_allowed_url "${normalized}/ko/"
|
||||
add_allowed_url "${normalized}/en"
|
||||
add_allowed_url "${normalized}/en/"
|
||||
add_allowed_url "${normalized}/auth/callback"
|
||||
add_allowed_url "${normalized}/ko/auth/callback"
|
||||
add_allowed_url "${normalized}/en/auth/callback"
|
||||
}
|
||||
|
||||
add_allowed_with_slash_variant "$KRATOS_UI_URL"
|
||||
add_allowed_with_slash_variant "$USERFRONT_URL"
|
||||
add_userfront_return_urls "$USERFRONT_URL"
|
||||
|
||||
for url in "${ADMIN_CALLBACKS[@]}"; do
|
||||
add_allowed_url "$url"
|
||||
|
||||
@@ -15,9 +15,31 @@ trap "cleanup; exit" INT TERM
|
||||
trap "cleanup" EXIT
|
||||
|
||||
mkdir -p reports
|
||||
rm -rf adminfront/node_modules
|
||||
|
||||
tmp_dir="$(mktemp -d /tmp/baron-sso-adminfront-tests.XXXXXX)"
|
||||
pnpm_store_dir="$tmp_dir/pnpm-store"
|
||||
seed_dir=""
|
||||
for candidate in \
|
||||
/tmp/baron-sso-adminfront-tests.FRPGmL \
|
||||
/tmp/baron-sso-adminfront-tests.mumSD6 \
|
||||
/tmp/baron-sso-adminfront-tests.pwAMAt; do
|
||||
if [ -d "$candidate/adminfront/node_modules" ] && \
|
||||
[ -d "$candidate/common/node_modules" ]; then
|
||||
seed_dir="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$seed_dir" ]; then
|
||||
for candidate in /tmp/baron-sso-adminfront-tests.*; do
|
||||
if [ "$candidate" != "$tmp_dir" ] && \
|
||||
[ -d "$candidate/adminfront/node_modules" ] && \
|
||||
[ -d "$candidate/common/node_modules" ]; then
|
||||
seed_dir="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
reuse_seed_node_modules=0
|
||||
mkdir -p "$tmp_dir/scripts"
|
||||
cp "$repo_root/scripts/playwrightHostDeps.cjs" "$tmp_dir/scripts/"
|
||||
|
||||
@@ -30,14 +52,30 @@ if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -rlptD --delete \
|
||||
--exclude 'node_modules' \
|
||||
"$repo_root/common/" "$tmp_dir/common/"
|
||||
rm -rf "$tmp_dir/common/node_modules"
|
||||
else
|
||||
cp -R "$repo_root/adminfront" "$tmp_dir/adminfront"
|
||||
cp -R "$repo_root/common" "$tmp_dir/common"
|
||||
rm -rf "$tmp_dir/adminfront/node_modules" \
|
||||
"$tmp_dir/common/node_modules" \
|
||||
"$tmp_dir/adminfront/playwright-report" \
|
||||
"$tmp_dir/adminfront/test-results"
|
||||
fi
|
||||
|
||||
if [ -n "$seed_dir" ] && [ "$seed_dir" != "$tmp_dir" ] && \
|
||||
[ -d "$seed_dir/adminfront/node_modules" ] && \
|
||||
[ -d "$seed_dir/common/node_modules" ]; then
|
||||
cp -a "$seed_dir/adminfront/node_modules" "$tmp_dir/adminfront/"
|
||||
cp -a "$seed_dir/common/node_modules" "$tmp_dir/common/"
|
||||
reuse_seed_node_modules=1
|
||||
fi
|
||||
|
||||
if [ ! -d "$tmp_dir/adminfront/node_modules" ] || \
|
||||
[ ! -d "$tmp_dir/common/node_modules" ]; then
|
||||
rm -rf "$tmp_dir/adminfront/playwright-report" \
|
||||
"$tmp_dir/adminfront/test-results"
|
||||
fi
|
||||
|
||||
is_port_available() {
|
||||
local port="$1"
|
||||
node -e '
|
||||
@@ -159,8 +197,12 @@ fi
|
||||
set +e
|
||||
(
|
||||
cd "$tmp_dir/adminfront"
|
||||
run_with_retry 3 npm install -g pnpm
|
||||
run_with_retry 3 pnpm install -C ../common --no-frozen-lockfile
|
||||
if [ "$reuse_seed_node_modules" -eq 0 ]; then
|
||||
if ! command -v pnpm >/dev/null 2>&1; then
|
||||
run_with_retry 3 npm install -g pnpm
|
||||
fi
|
||||
run_with_retry 3 pnpm install -C ../common --no-frozen-lockfile --store-dir "$pnpm_store_dir"
|
||||
fi
|
||||
) 2>&1 | tee reports/adminfront-install.log
|
||||
install_exit_code=${PIPESTATUS[0]}
|
||||
set -e
|
||||
@@ -175,7 +217,7 @@ if [ "$install_exit_code" -ne 0 ]; then
|
||||
echo "- Exit Code: \`$install_exit_code\`"
|
||||
echo
|
||||
echo "## Command"
|
||||
echo "\`cd adminfront && npm install -g pnpm && pnpm install -C ../common --no-frozen-lockfile\`"
|
||||
echo "\`cd adminfront && if [ \"$reuse_seed_node_modules\" -eq 0 ]; then if ! command -v pnpm >/dev/null 2>&1; then npm install -g pnpm; fi && pnpm install -C ../common --no-frozen-lockfile --store-dir \"\$TMPDIR/pnpm-store\"; fi\`"
|
||||
echo
|
||||
echo "## Install Log Tail (last 200 lines)"
|
||||
echo '```text'
|
||||
@@ -242,7 +284,7 @@ if [ "$test_exit_code" -ne 0 ]; then
|
||||
echo
|
||||
echo "## Commands"
|
||||
echo "1. \`cd adminfront\`"
|
||||
echo "2. \`npm install -g pnpm && pnpm install -C ../common --no-frozen-lockfile\`"
|
||||
echo "2. \`if [ \"$reuse_seed_node_modules\" -eq 0 ]; then if ! command -v pnpm >/dev/null 2>&1; then npm install -g pnpm; fi && pnpm install -C ../common --no-frozen-lockfile --store-dir \"\$TMPDIR/pnpm-store\"; fi\`"
|
||||
echo "3. \`${playwright_install_desc}\`"
|
||||
echo "4. \`npx playwright test\`"
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user