From 076ada648a93af9bff4e839f8db4658ee81b3fd9 Mon Sep 17 00:00:00 2001 From: suzmii Date: Thu, 27 Aug 2026 16:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20SpacetimeDB=202.8.3=20?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 Jenkins Server-Provision 的 SpacetimeDB 下载根与 CLI commit 默认值 同步容器部署文档中的 SpacetimeDB 版本说明 补充生产运维门禁,防止 Jenkins 版本配置回退 --- deploy/container/README.md | 4 +- .../Jenkinsfile.production-server-provision | 8 ++-- scripts/check-production-ops-guardrails.mjs | 40 +++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/deploy/container/README.md b/deploy/container/README.md index 1de8a3489..6631905a1 100644 --- a/deploy/container/README.md +++ b/deploy/container/README.md @@ -56,7 +56,7 @@ Linux Docker Engine 若要从宿主机 CLI 连到容器内服务,直接用 `ht ## 构建工具链 -`api-server` 容器镜像只构建 Linux release API 二进制,不构建 `spacetime-module`。当前 `api-server -> spacetime-client -> spacetimedb-sdk 2.7.0` 依赖链继续兼容 Rust 1.93,因此 `deploy/container/api-server.Dockerfile` 的 Rust builder 固定为 `rust:1.93-bookworm`。Web builder 显式安装并校验 npm `10.9.7`,再按唯一根 workspace lock 执行一次 `npm ci`,不依赖 Node 基础镜像隐含的 npm 版本。镜像构建阶段会同时复制 `public/`,用于满足 API 二进制里 `include_bytes!` 引用的内置素材;不要把 `public/generated-*` 放入镜像上下文。如果本机 Docker Hub 拉取失败,可以先在本机准备同名本地 builder 镜像,但不要把临时 bootstrap 容器或私有 registry 凭据写入仓库。 +`api-server` 容器镜像只构建 Linux release API 二进制,不构建 `spacetime-module`。当前 `api-server -> spacetime-client -> spacetimedb-sdk 2.8.3` 依赖链继续兼容 Rust 1.93,因此 `deploy/container/api-server.Dockerfile` 的 Rust builder 固定为 `rust:1.93-bookworm`。Web builder 显式安装并校验 npm `10.9.7`,再按唯一根 workspace lock 执行一次 `npm ci`,不依赖 Node 基础镜像隐含的 npm 版本。镜像构建阶段会同时复制 `public/`,用于满足 API 二进制里 `include_bytes!` 引用的内置素材;不要把 `public/generated-*` 放入镜像上下文。如果本机 Docker Hub 拉取失败,可以先在本机准备同名本地 builder 镜像,但不要把临时 bootstrap 容器或私有 registry 凭据写入仓库。 ### Jenkins 预览 secrets 镜像边界 @@ -164,7 +164,7 @@ npm run container:worker-smoke -- status npm run container:worker-smoke -- smoke --force ``` -`container:worker-smoke` 默认会把本机 `spacetime` 2.7.0 CLI 打成轻量 SpacetimeDB 镜像,避免首次 smoke 必须拉取官方大镜像;普通 `npm run container:*` 压测默认使用 `clockworklabs/spacetime:v2.7.0-hotfix3`(容器内二进制报告 2.7.0)。如果 Docker build 阶段在容器内拉取 crates.io 依赖不稳定,可让容器内 Cargo 复用本机 Cargo 缓存构建当前二进制,再打入临时 smoke 镜像。该模式默认使用 `rust:1.93-bookworm` 作为 builder、Debian bookworm smoke runtime 承载构建产物;需要换 builder 镜像时设置 `GENARRATIVE_WORKER_SMOKE_CARGO_IMAGE`,需要换运行时基础镜像时设置 `GENARRATIVE_WORKER_SMOKE_LOCAL_BASE_IMAGE`: +`container:worker-smoke` 默认会把本机 `spacetime` 2.8.3 CLI 打成轻量 SpacetimeDB 镜像,避免首次 smoke 必须拉取官方大镜像;普通 `npm run container:*` 压测默认使用 `clockworklabs/spacetime:v2.8.3`(容器内二进制报告 2.8.3)。如果 Docker build 阶段在容器内拉取 crates.io 依赖不稳定,可让容器内 Cargo 复用本机 Cargo 缓存构建当前二进制,再打入临时 smoke 镜像。该模式默认使用 `rust:1.93-bookworm` 作为 builder、Debian bookworm smoke runtime 承载构建产物;需要换 builder 镜像时设置 `GENARRATIVE_WORKER_SMOKE_CARGO_IMAGE`,需要换运行时基础镜像时设置 `GENARRATIVE_WORKER_SMOKE_LOCAL_BASE_IMAGE`: ```bash npm run container:worker-smoke -- smoke --local-binary diff --git a/jenkins/Jenkinsfile.production-server-provision b/jenkins/Jenkinsfile.production-server-provision index 69ea81c22..f0233318b 100644 --- a/jenkins/Jenkinsfile.production-server-provision +++ b/jenkins/Jenkinsfile.production-server-provision @@ -25,8 +25,8 @@ pipeline { string(name: 'PROVISION_DOWNLOADS_DIR', defaultValue: 'provision-tool-downloads', description: '目标服务器工作区内暂存 SpacetimeDB/otelcol 安装包的相对目录') string(name: 'PROVISION_TOOLS_DIR', defaultValue: 'provision-tools', description: '目标机工作区内由已下载安装包生成的工具包目录') string(name: 'PROVISION_DOWNLOAD_PROXY', defaultValue: '', description: '可选,目标服务器下载 SpacetimeDB 和 otelcol-contrib 时使用的代理地址,例如 http://127.0.0.1:7890;留空不设置代理') - string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.7.0-hotfix3', description: '目标服务器使用的 SpacetimeDB Linux release tarball 根地址;默认固定到项目锁定版本的官方 hotfix 资产标签') - string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: 'd220349adb7af7eefa810eb08a185609356b83f6', description: 'SpacetimeDB CLI 预期构建 commit;用于拒绝同版本号但缺少 hotfix 的旧二进制') + string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3', description: '目标服务器使用的 SpacetimeDB Linux release tarball 根地址;默认固定到项目锁定版本的官方资产标签') + string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: '8e410d2842147bd8e5a32a9589cc00c19f7478e2', description: 'SpacetimeDB CLI 预期构建 commit;用于拒绝同版本号但 commit 不匹配的旧二进制') string(name: 'SPACETIME_TARGET_HOST', defaultValue: 'x86_64-unknown-linux-gnu', description: 'SpacetimeDB 预编译包 host triple,development/release Linux amd64 使用默认值') string(name: 'SPACETIME_ROOT', defaultValue: '/stdb', description: 'SpacetimeDB root-dir') string(name: 'RELEASE_ROOT', defaultValue: '/opt/genarrative/releases', description: 'release 根目录') @@ -213,8 +213,8 @@ BASH OTELCOL_VERSION="${OTELCOL_VERSION:-0.151.0}" \ PREPARE_OTELCOL="${ENABLE_OTELCOL:-true}" \ PROVISION_DOWNLOAD_PROXY="${PROVISION_DOWNLOAD_PROXY:-}" \ - SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.7.0-hotfix3}" \ - SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-d220349adb7af7eefa810eb08a185609356b83f6}" \ + SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3}" \ + SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-8e410d2842147bd8e5a32a9589cc00c19f7478e2}" \ SPACETIME_TARGET_HOST="${SPACETIME_TARGET_HOST:-x86_64-unknown-linux-gnu}" \ SPACETIME_ROOT="${SPACETIME_ROOT:-/stdb}" \ scripts/prepare-server-provision-tools.sh diff --git a/scripts/check-production-ops-guardrails.mjs b/scripts/check-production-ops-guardrails.mjs index c567e8232..c9463ace6 100644 --- a/scripts/check-production-ops-guardrails.mjs +++ b/scripts/check-production-ops-guardrails.mjs @@ -899,6 +899,46 @@ const checks = [ reason: 'Server-Provision Job 必须允许 dev/release 为 files-history 选择各自的 baseline state 目录。', }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + includes: + "string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3'", + reason: + 'Server-Provision Job 的 SpacetimeDB 下载根必须与 workspace 锁定的 2.8.3 版本一致。', + }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + includes: + "string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: '8e410d2842147bd8e5a32a9589cc00c19f7478e2'", + reason: + 'Server-Provision Job 必须锁定 SpacetimeDB 2.8.3 的 CLI commit,拒绝同版本号但构建来源不一致的二进制。', + }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + includes: + 'SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3}"', + reason: + 'Server-Provision 执行阶段的 SpacetimeDB 下载根默认值必须与 Job 参数默认值一致。', + }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + includes: + 'SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-8e410d2842147bd8e5a32a9589cc00c19f7478e2}"', + reason: + 'Server-Provision 执行阶段的 SpacetimeDB commit 默认值必须与 Job 参数默认值一致。', + }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + excludes: 'v2.7.0-hotfix3', + reason: + 'Server-Provision 不得保留已退役的 SpacetimeDB 2.7.0 hotfix 资产标签。', + }, + { + file: 'jenkins/Jenkinsfile.production-server-provision', + excludes: 'd220349adb7af7eefa810eb08a185609356b83f6', + reason: + 'Server-Provision 不得保留 SpacetimeDB 2.7.0 的旧 CLI commit 门禁。', + }, { file: 'jenkins/Jenkinsfile.production-server-provision', excludes: