From c6335c2dcf365bba3f9397ff4b4f7ef5340bf591 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 15 Jun 2026 22:02:52 +0800 Subject: [PATCH] fix: preserve exact runtime asset names --- ...ffline-package-ai-workspace-installer.yaml | 6 +++-- scripts/ai-workspace-offline-install.sh | 24 +++++++++++++++++-- .../create-ai-workspace-offline-package.sh | 12 +++++----- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/offline-package-ai-workspace-installer.yaml b/.github/workflows/offline-package-ai-workspace-installer.yaml index 514a279..e35f328 100644 --- a/.github/workflows/offline-package-ai-workspace-installer.yaml +++ b/.github/workflows/offline-package-ai-workspace-installer.yaml @@ -197,8 +197,10 @@ jobs: grep -q 'metadata/target.env' contents.txt grep -q 'repos/playbooks' contents.txt grep -q 'repos/xworkspace-console' contents.txt - grep -q 'packages/components/xworkspace-console-runtime.tar.gz' contents.txt - grep -q 'packages/components/qmd-runtime.tar.gz' contents.txt + grep -q 'packages/components/xworkspace-console-runtime-linux-${{ matrix.arch }}.tar.gz' contents.txt + grep -q 'packages/components/xworkmate-bridge-linux-${{ matrix.arch }}.tar.gz' contents.txt + grep -q 'packages/components/qmd-runtime-linux-${{ matrix.arch }}.tar.gz' contents.txt + grep -q 'packages/components/litellm-runtime-${{ matrix.distro }}-${{ matrix.version }}-${{ matrix.arch }}.tar.gz' contents.txt grep -q 'metadata/litellm-runtime.env' contents.txt grep -q 'metadata/components/xworkmate-bridge.tag' contents.txt grep -q 'packages/apt/Packages.gz' contents.txt diff --git a/scripts/ai-workspace-offline-install.sh b/scripts/ai-workspace-offline-install.sh index e95e6d5..9a3f0a4 100755 --- a/scripts/ai-workspace-offline-install.sh +++ b/scripts/ai-workspace-offline-install.sh @@ -2,9 +2,18 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +if [ -f "${ROOT}/metadata/target.env" ]; then + # shellcheck disable=SC1091 + source "${ROOT}/metadata/target.env" +fi APT_DIR="${ROOT}/packages/apt" BIN_DIR="${ROOT}/packages/bin" COMPONENT_DIR="${ROOT}/packages/components" +TARGET_ARCH="${ARCH:-}" +CONSOLE_RUNTIME_ASSET="${COMPONENT_DIR}/xworkspace-console-runtime-linux-${TARGET_ARCH}.tar.gz" +BRIDGE_RUNTIME_ASSET="${COMPONENT_DIR}/xworkmate-bridge-linux-${TARGET_ARCH}.tar.gz" +QMD_RUNTIME_ASSET="${COMPONENT_DIR}/qmd-runtime-linux-${TARGET_ARCH}.tar.gz" +LITELLM_RUNTIME_ASSET="${COMPONENT_DIR}/litellm-runtime-${DISTRO_ID:-}-${DISTRO_VERSION:-}-${TARGET_ARCH}.tar.gz" IMAGE_DIR="${ROOT}/packages/images" NPM_CACHE_DIR="${ROOT}/packages/npm-cache" NPM_RUNTIME_CACHE_DIR="${AI_WORKSPACE_NPM_CACHE_DIR:-/var/cache/ai-workspace/npm}" @@ -191,6 +200,15 @@ install_bundled_binaries() { rm -rf "${tmp}" fi + if [ -f "${BRIDGE_RUNTIME_ASSET}" ]; then + local bridge_extract + bridge_extract="$(mktemp -d)" + tar -xzf "${BRIDGE_RUNTIME_ASSET}" -C "${bridge_extract}" + install -m 0755 "${bridge_extract}/xworkmate-bridge/bin/xworkmate-go-core" \ + "${BIN_DIR}/xworkmate-go-core.${TARGET_ARCH}" + rm -rf "${bridge_extract}" + fi + case "$(uname -m)" in x86_64|amd64) ttyd_arch=x86_64 ;; aarch64|arm64) ttyd_arch=aarch64 ;; @@ -386,8 +404,10 @@ run_bootstrap() { export PLAYBOOK_DIR="${PLAYBOOK_DIR:-${ROOT}/repos/playbooks}" export XWORKSPACE_CONSOLE_DIR="${XWORKSPACE_CONSOLE_DIR:-${ROOT}/repos/xworkspace-console}" export XWORKSPACE_CORE_SKILLS_DIR="${XWORKSPACE_CORE_SKILLS_DIR:-${ROOT}/repos/xworkspace-core-skills}" - export XWORKSPACE_CONSOLE_RUNTIME_ARCHIVE="${XWORKSPACE_CONSOLE_RUNTIME_ARCHIVE:-${COMPONENT_DIR}/xworkspace-console-runtime.tar.gz}" - export QMD_RUNTIME_ARCHIVE="${QMD_RUNTIME_ARCHIVE:-${COMPONENT_DIR}/qmd-runtime.tar.gz}" + export XWORKSPACE_CONSOLE_RUNTIME_ARCHIVE="${XWORKSPACE_CONSOLE_RUNTIME_ARCHIVE:-${CONSOLE_RUNTIME_ASSET}}" + export QMD_RUNTIME_ARCHIVE="${QMD_RUNTIME_ARCHIVE:-${QMD_RUNTIME_ASSET}}" + [ -f "${LITELLM_RUNTIME_ASSET}" ] || + { echo "Exact LiteLLM runtime asset is missing: ${LITELLM_RUNTIME_ASSET}" >&2; exit 1; } if [ -f "${ROOT}/metadata/litellm-runtime.env" ]; then # shellcheck disable=SC1091 source "${ROOT}/metadata/litellm-runtime.env" diff --git a/scripts/create-ai-workspace-offline-package.sh b/scripts/create-ai-workspace-offline-package.sh index 60c145b..fba6968 100755 --- a/scripts/create-ai-workspace-offline-package.sh +++ b/scripts/create-ai-workspace-offline-package.sh @@ -144,18 +144,18 @@ download_component_releases() { mkdir -p "${component_dir}" "${bridge_tmp}" "${litellm_tmp}" "${WORKDIR}/packages/bin" download_release_asset "${CONSOLE_RUNTIME_RELEASE_REPO}" "${CONSOLE_RUNTIME_RELEASE_TAG}" \ - "${console_asset}" "${component_dir}/xworkspace-console-runtime.tar.gz" xworkspace-console + "${console_asset}" "${component_dir}/${console_asset}" xworkspace-console download_release_asset "${BRIDGE_RUNTIME_RELEASE_REPO}" "${BRIDGE_RUNTIME_RELEASE_TAG}" \ - "${bridge_asset}" "${bridge_tmp}/${bridge_asset}" xworkmate-bridge + "${bridge_asset}" "${component_dir}/${bridge_asset}" xworkmate-bridge download_release_asset "${QMD_RUNTIME_RELEASE_REPO}" "${QMD_RUNTIME_RELEASE_TAG}" \ - "${qmd_asset}" "${component_dir}/qmd-runtime.tar.gz" qmd + "${qmd_asset}" "${component_dir}/${qmd_asset}" qmd download_release_asset "${LITELLM_RUNTIME_RELEASE_REPO}" "${LITELLM_RUNTIME_RELEASE_TAG}" \ - "${litellm_asset}" "${litellm_tmp}/${litellm_asset}" litellm + "${litellm_asset}" "${component_dir}/${litellm_asset}" litellm - tar -xzf "${bridge_tmp}/${bridge_asset}" -C "${bridge_tmp}" + tar -xzf "${component_dir}/${bridge_asset}" -C "${bridge_tmp}" install -m 0755 "${bridge_tmp}/xworkmate-bridge/bin/xworkmate-go-core" \ "${WORKDIR}/packages/bin/xworkmate-go-core.${ARCH}" - tar -xzf "${litellm_tmp}/${litellm_asset}" -C "${litellm_tmp}" + tar -xzf "${component_dir}/${litellm_asset}" -C "${litellm_tmp}" cp -a "${litellm_tmp}/litellm-runtime/packages/pip" "${WORKDIR}/packages/" if [ -d "${litellm_tmp}/litellm-runtime/packages/python" ]; then cp -a "${litellm_tmp}/litellm-runtime/packages/python" "${WORKDIR}/packages/"