mirror of
https://github.com/iflytek/skillhub.git
synced 2026-08-27 11:14:59 +00:00
fix(deploy): avoid changing runtime helper for PR 576
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
5e3f4e72e7
commit
9668f3cd5a
2 changed files with 0 additions and 71 deletions
|
|
@ -13,7 +13,6 @@ SKILLHUB_HOME_DEFAULT="${TMPDIR:-/tmp}/skillhub-runtime"
|
|||
SKILLHUB_HOME="${SKILLHUB_HOME:-$SKILLHUB_HOME_DEFAULT}"
|
||||
SKILLHUB_VERSION_VALUE="${SKILLHUB_VERSION:-}"
|
||||
SKILLHUB_PUBLIC_BASE_URL_VALUE="${SKILLHUB_PUBLIC_BASE_URL:-}"
|
||||
SKILLHUB_WEB_BASE_PATH_VALUE="${SKILLHUB_WEB_BASE_PATH:-}"
|
||||
SKILLHUB_ALIYUN_REGISTRY="${SKILLHUB_ALIYUN_REGISTRY:-crpi-ptu2rqimrigtq0qx.cn-hangzhou.personal.cr.aliyuncs.com}"
|
||||
SKILLHUB_ALIYUN_NAMESPACE="${SKILLHUB_ALIYUN_NAMESPACE:-skill_hub}"
|
||||
SKILLHUB_MIRROR_REGISTRY_VALUE="${SKILLHUB_MIRROR_REGISTRY:-}"
|
||||
|
|
@ -90,11 +89,6 @@ while [ "$#" -gt 0 ]; do
|
|||
SKILLHUB_PUBLIC_BASE_URL_VALUE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--base-path)
|
||||
[ "$#" -ge 2 ] || { echo "Missing value for --base-path" >&2; exit 1; }
|
||||
SKILLHUB_WEB_BASE_PATH_VALUE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help|-h)
|
||||
cat <<EOF
|
||||
Usage: sh runtime.sh [up|down|clean|ps|logs|pull] [options]
|
||||
|
|
@ -106,7 +100,6 @@ Options:
|
|||
--home <dir> Store runtime files in a specific directory
|
||||
--ref <git-ref> Download runtime files from a specific Git ref
|
||||
--public-url <url> Public access URL (e.g. https://skill.example.com)
|
||||
--base-path <path> Serve Web UI under a sub-path, e.g. /skillhub/
|
||||
--server-image <img> Override backend image repository
|
||||
--web-image <img> Override frontend image repository
|
||||
--scanner-image <img> Override scanner image repository
|
||||
|
|
@ -190,46 +183,6 @@ set_env_value() {
|
|||
secure_env_file
|
||||
}
|
||||
|
||||
normalize_base_path() {
|
||||
value="$1"
|
||||
[ -n "$value" ] || { echo "--base-path must not be empty" >&2; exit 1; }
|
||||
|
||||
case "$value" in
|
||||
/)
|
||||
printf '/'
|
||||
return 0
|
||||
;;
|
||||
/*/) ;;
|
||||
/*) value="$value/" ;;
|
||||
*) value="/$value/" ;;
|
||||
esac
|
||||
|
||||
case "$value" in
|
||||
*//*|*[!A-Za-z0-9._~/-]*)
|
||||
echo "--base-path contains unsupported characters: $value" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$value" in
|
||||
*/./*|*/../*)
|
||||
echo "--base-path must not contain '.' or '..' path segments: $value" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
first_segment=${value#/}
|
||||
first_segment=${first_segment%%/*}
|
||||
case "$first_segment" in
|
||||
api|oauth2|login|assets|registry|nginx-health|.well-known|runtime-config.js)
|
||||
echo "--base-path must not start with a reserved SkillHub path segment: $first_segment" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
printf '%s' "$value"
|
||||
}
|
||||
|
||||
secure_env_file() {
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
chmod 600 "$ENV_FILE"
|
||||
|
|
@ -406,16 +359,6 @@ prepare_runtime_files() {
|
|||
set_env_value "SKILLHUB_PUBLIC_BASE_URL" "$SKILLHUB_PUBLIC_BASE_URL_VALUE"
|
||||
fi
|
||||
|
||||
if [ -n "$SKILLHUB_WEB_BASE_PATH_VALUE" ]; then
|
||||
normalized_base_path="$(normalize_base_path "$SKILLHUB_WEB_BASE_PATH_VALUE")"
|
||||
set_env_value "SKILLHUB_WEB_BASE_PATH" "$normalized_base_path"
|
||||
if [ "$normalized_base_path" = "/" ]; then
|
||||
set_env_value "SKILLHUB_WEB_API_BASE_URL" ""
|
||||
else
|
||||
set_env_value "SKILLHUB_WEB_API_BASE_URL" "${normalized_base_path%/}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DISABLE_SCANNER" = "true" ]; then
|
||||
set_env_value "SKILLHUB_SECURITY_SCANNER_ENABLED" "false"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -120,18 +120,4 @@ grep -Fq "SKILLHUB_SECURITY_SCANNER_ENABLED=false" "$home_no_scanner/.env.releas
|
|||
grep -Fq -- "up -d --no-deps --scale skill-scanner=0 server web" "$home_no_scanner/docker.log" \
|
||||
|| fail "runtime --no-scanner should start server/web without waiting on scanner dependencies"
|
||||
|
||||
home_sub_path="$tmp/sub-path"
|
||||
stdout_sub_path="$tmp/sub-path.out"
|
||||
mkdir -p "$home_sub_path"
|
||||
run_runtime "$home_sub_path" "$bin_dir" "$stdout_sub_path" \
|
||||
--public-url http://localhost/skillhub \
|
||||
--base-path skillhub
|
||||
|
||||
grep -Fq "SKILLHUB_PUBLIC_BASE_URL=http://localhost/skillhub" "$home_sub_path/.env.release" \
|
||||
|| fail "runtime should persist the public URL for sub-path deployments"
|
||||
grep -Fq "SKILLHUB_WEB_BASE_PATH=/skillhub/" "$home_sub_path/.env.release" \
|
||||
|| fail "runtime should normalize and persist SKILLHUB_WEB_BASE_PATH"
|
||||
grep -Fq "SKILLHUB_WEB_API_BASE_URL=/skillhub" "$home_sub_path/.env.release" \
|
||||
|| fail "runtime should align SKILLHUB_WEB_API_BASE_URL with the base path"
|
||||
|
||||
echo "runtime-secret-test passed"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue