mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-09 03:17:52 +00:00
fix(deploy): bake web base path for old HK helper
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
3fdc8cf037
commit
ae36d05fe4
3 changed files with 33 additions and 15 deletions
10
.github/workflows/pr-batch-test-deploy.yml
vendored
10
.github/workflows/pr-batch-test-deploy.yml
vendored
|
|
@ -74,6 +74,7 @@ jobs:
|
|||
echo "key_file=${key_file}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Preflight HK deploy helper
|
||||
id: hk-helper
|
||||
env:
|
||||
TEST_RUNTIME_SSH_HOST: ${{ secrets.TEST_RUNTIME_SSH_HOST }}
|
||||
TEST_RUNTIME_SSH_USER: ${{ secrets.TEST_RUNTIME_SSH_USER }}
|
||||
|
|
@ -82,6 +83,7 @@ jobs:
|
|||
WEB_BASE_PATH: ${{ inputs.web_base_path }}
|
||||
run: |
|
||||
if [[ -z "${PUBLIC_URL}" && -z "${WEB_BASE_PATH}" ]]; then
|
||||
echo "subpath_supported=false" >> "${GITHUB_OUTPUT}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
@ -99,10 +101,12 @@ jobs:
|
|||
|
||||
if ! grep -Fq -- "--public-url" <<<"${helper_help}" || \
|
||||
! grep -Fq -- "--web-base-path" <<<"${helper_help}"; then
|
||||
echo "::error::HK deploy helper is outdated. Install scripts/skillhub-test-deploy-remote.sh to /usr/local/bin/skillhub-test-deploy before sub-path validation."
|
||||
echo "::warning::HK deploy helper is outdated. The workflow will bake the requested web base path into the web image, but the helper should still be updated to write SKILLHUB_PUBLIC_BASE_URL and SKILLHUB_WEB_API_BASE_URL at runtime."
|
||||
echo "${helper_help}"
|
||||
exit 1
|
||||
echo "subpath_supported=false" >> "${GITHUB_OUTPUT}"
|
||||
exit 0
|
||||
fi
|
||||
echo "subpath_supported=true" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
|
@ -145,6 +149,8 @@ jobs:
|
|||
context: ./web
|
||||
file: ./web/Dockerfile
|
||||
platforms: ${{ env.DOCKER_PLATFORM }}
|
||||
build-args: |
|
||||
VITE_BASE_PATH=${{ inputs.web_base_path || '/__SKILLHUB_WEB_BASE_PATH__/' }}
|
||||
push: true
|
||||
provenance: false
|
||||
sbom: false
|
||||
|
|
|
|||
|
|
@ -66,8 +66,11 @@ For sub-path validation, the installed helper must support:
|
|||
- `--public-url`
|
||||
- `--web-base-path`
|
||||
|
||||
`scripts/deploy-test-runtime.sh` checks this before deployment and fails fast if the
|
||||
HK helper is outdated.
|
||||
The workflow checks this before building images. If the HK helper is outdated,
|
||||
the workflow still bakes the requested web base path into the web image so
|
||||
`/skillhub/runtime-config.js` and `/skillhub/api/...` routing can be validated.
|
||||
However, update the helper before treating `SKILLHUB_PUBLIC_BASE_URL` and
|
||||
`SKILLHUB_WEB_API_BASE_URL` as runtime-configured on the HK machine.
|
||||
|
||||
## Recommended usage
|
||||
|
||||
|
|
|
|||
|
|
@ -187,26 +187,35 @@ if [[ -n "${web_base_path}" ]]; then
|
|||
normalized_web_base_path="$(normalize_base_path "${web_base_path}")"
|
||||
fi
|
||||
|
||||
helper_supports_sub_path=true
|
||||
if [[ -n "${public_url}" || -n "${web_base_path}" ]]; then
|
||||
helper_help="$(sudo /usr/local/bin/skillhub-test-deploy --help 2>&1 || true)"
|
||||
if ! grep -Fq -- "--public-url" <<<"${helper_help}" || \
|
||||
! grep -Fq -- "--web-base-path" <<<"${helper_help}"; then
|
||||
helper_supports_sub_path=false
|
||||
echo "HK deploy helper is outdated: /usr/local/bin/skillhub-test-deploy" >&2
|
||||
echo "Install the current scripts/skillhub-test-deploy-remote.sh on the HK machine before sub-path validation." >&2
|
||||
echo "Required helper options: --public-url and --web-base-path" >&2
|
||||
exit 1
|
||||
echo "Falling back to a web image with the requested base path baked at build time." >&2
|
||||
echo "Update scripts/skillhub-test-deploy-remote.sh on the HK machine to let runtime env write SKILLHUB_PUBLIC_BASE_URL and SKILLHUB_WEB_API_BASE_URL." >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
deploy_status=0
|
||||
sudo /usr/local/bin/skillhub-test-deploy \
|
||||
--deploy-tag "${deploy_tag}" \
|
||||
--immutable-tag "${immutable_tag}" \
|
||||
--merged-sha "${merged_sha}" \
|
||||
--pr-csv "${pr_csv}" \
|
||||
--run-url "${run_url}" \
|
||||
--public-url "${public_url}" \
|
||||
--web-base-path "${web_base_path}" || deploy_status=$?
|
||||
deploy_args=(
|
||||
--deploy-tag "${deploy_tag}"
|
||||
--immutable-tag "${immutable_tag}"
|
||||
--merged-sha "${merged_sha}"
|
||||
--pr-csv "${pr_csv}"
|
||||
--run-url "${run_url}"
|
||||
)
|
||||
|
||||
if [[ "${helper_supports_sub_path}" == "true" ]]; then
|
||||
deploy_args+=(
|
||||
--public-url "${public_url}"
|
||||
--web-base-path "${web_base_path}"
|
||||
)
|
||||
fi
|
||||
|
||||
sudo /usr/local/bin/skillhub-test-deploy "${deploy_args[@]}" || deploy_status=$?
|
||||
|
||||
web_health_paths=("/nginx-health")
|
||||
if [[ -n "${normalized_web_base_path}" && "${normalized_web_base_path}" != "/" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue