修复 Gitea CI 镜像构建并刷新到 1.98.1 工具链
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Failing after 7m11s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Failing after 7m35s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Failing after 7m37s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Failing after 8m21s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m18s
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Failing after 7m11s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Failing after 7m35s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Failing after 7m37s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Failing after 8m21s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m18s
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
- 将 AGC 本地路径依赖的 cocos/unity/godot 编辑器 bridge crate 纳入镜像构建上下文与 dockerignore,修复 cargo fetch --locked 找不到 cocos-editor-bridge 导致的镜像构建失败 - 将 Chrome pin 由已下架的 150.0.7871.181-1 更新为当前 stable 153.0.8010.52-1 - 固定 Node/npm 解析:用绝对路径 wrapper 覆盖 base 镜像的 /opt/acttoolcache bin,避免 npm ci 的 node_modules/.bin 与 toolcache 影子化固定工具链 - 为镜像预热的 npm ci 增加最多 5 次整命令级有界重试,处理 registry ECONNRESET - 镜像 tag 与 LABEL 升为 20260920.2,并同步 deploy/container/README.md 与开发运维文档 - 在 scripts/project-ci-workflow.test.ts 中钉住 bridge crate 构建上下文与固定工具链 wrapper
This commit is contained in:
@@ -68,18 +68,18 @@ Jenkins 分支预览构建固定从宿主 `/data/jenkins/preview-secrets/.env.lo
|
||||
|
||||
### Gitea CI 预构建 Job 镜像
|
||||
|
||||
`.gitea/workflows/project-ci.yml` 的四个 job 统一使用 `deploy/container/gitea-ci-job.Dockerfile` 构建的 `genarrative-ci` 环境。镜像固定 Ubuntu job base digest `sha256:58ea92624c7c09582e05594d95488331045053d3a3f34cf09649f2a32313a614` 和 Rust stage digest `sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e`;Node `22.23.1` 发行包在解压前执行 SHA-256 校验,Google Linux 主签名指纹固定为 `EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796`,Chrome 固定为 `150.0.7871.181-1`。镜像预装 Rust `1.98.1`、`rustfmt`、Chrome、`bwrap`、`rg`、`ffmpeg`、`clang/lld` 和 Tauri / 后端系统依赖,并设置 `RUSTUP_AUTO_INSTALL=0`;仓库工具链变更时必须先重建镜像,不允许 job 现场下载补齐。
|
||||
`.gitea/workflows/project-ci.yml` 的四个 job 统一使用 `deploy/container/gitea-ci-job.Dockerfile` 构建的 `genarrative-ci` 环境。镜像固定 Ubuntu job base digest `sha256:58ea92624c7c09582e05594d95488331045053d3a3f34cf09649f2a32313a614` 和 Rust stage digest `sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e`;Node `22.23.1` 发行包在解压前执行 SHA-256 校验,Google Linux 主签名指纹固定为 `EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796`,Chrome 固定为 `153.0.8010.52-1`。镜像预装 Rust `1.98.1`、`rustfmt`、Chrome、`bwrap`、`rg`、`ffmpeg`、`clang/lld` 和 Tauri / 后端系统依赖,并设置 `RUSTUP_AUTO_INSTALL=0`;仓库工具链变更时必须先重建镜像,不允许 job 现场下载补齐。
|
||||
|
||||
构建、校验和装入 runner 内层 Docker:
|
||||
|
||||
```bash
|
||||
bash scripts/gitea-ci-job-image.sh build
|
||||
bash scripts/gitea-ci-job-image.sh verify
|
||||
bash scripts/gitea-ci-job-image.sh export /仓库外受控路径/genarrative-gitea-project-ci-20260920.1.tar.zst
|
||||
bash scripts/gitea-ci-job-image.sh export /仓库外受控路径/genarrative-gitea-project-ci-20260920.2.tar.zst
|
||||
bash scripts/gitea-ci-job-image.sh load-runner
|
||||
```
|
||||
|
||||
默认构建 tag 为 `genarrative/gitea-project-ci:20260920.1`。脚本通过 NUL 分隔白名单 tar 流只发送 Dockerfile、checkout 脚本、根 workspace 的唯一 npm lock 与全部 workspace manifest,以及 server-rs、桌面壳和 AI 游戏创作壳的 Cargo manifests/lock;不会把业务源码、素材或本地私密文件发送给 Docker daemon。新镜像显式安装并精确校验 `npm 10.9.7`,不依赖 Node 发行包隐含的 npm 版本;除固定工具链外,还按一份 npm workspace lock 与三份 Cargo lock 预热下载缓存。npm 只执行一次忽略 lifecycle scripts 的 workspace `npm ci`,三个 `cargo fetch --locked` 最多执行 5 次整命令级有界重试,再分别以断网 `cargo fetch --locked` 验证缓存闭合,镜像不包含 `node_modules` 或 Cargo `target`。`build` 完成后会自动运行环境校验,`load-runner` 还会比对宿主和 runner 内层的完整 Image ID,并在内层执行 bwrap 与 Chrome headless canary。workspace lock 或 manifest 变化落地后必须按下述顺序重建并装载镜像;过渡期旧固定镜像缺少 `GENARRATIVE_GITEA_CI_NPM_VERSION` 时,校验只输出 `npm_version=partial` 和 Actions warning,继续由当前 job 的根 `npm ci` 验证唯一 lock,不能据此宣称 npm 版本或新依赖缓存已经闭合。执行这些命令不要求必须使用 root,但执行账号必须有权访问宿主 Docker API 并管理 runner 容器;没有该权限时交给 runner 运维人员执行。
|
||||
默认构建 tag 为 `genarrative/gitea-project-ci:20260920.2`。脚本通过 NUL 分隔白名单 tar 流只发送 Dockerfile、checkout 脚本、根 workspace 的唯一 npm lock 与全部 workspace manifest,以及 server-rs、桌面壳和 AI 游戏创作壳的 Cargo manifests/lock,外加 AI 游戏创作壳本地路径依赖的三个编辑器 bridge crate 源树;不会把业务源码、素材或本地私密文件发送给 Docker daemon。新镜像显式安装并精确校验 `npm 10.9.7`,不依赖 Node 发行包隐含的 npm 版本;除固定工具链外,还按一份 npm workspace lock 与三份 Cargo lock 预热下载缓存。npm 只执行一次忽略 lifecycle scripts 的 workspace `npm ci`(最多 5 次整命令级有界重试,处理 registry ECONNRESET),三个 `cargo fetch --locked` 最多执行 5 次整命令级有界重试,再分别以断网 `cargo fetch --locked` 验证缓存闭合,镜像不包含 `node_modules` 或 Cargo `target`。`build` 完成后会自动运行环境校验,`load-runner` 还会比对宿主和 runner 内层的完整 Image ID,并在内层执行 bwrap 与 Chrome headless canary。workspace lock 或 manifest 变化落地后必须按下述顺序重建并装载镜像;过渡期旧固定镜像缺少 `GENARRATIVE_GITEA_CI_NPM_VERSION` 时,校验只输出 `npm_version=partial` 和 Actions warning,继续由当前 job 的根 `npm ci` 验证唯一 lock,不能据此宣称 npm 版本或新依赖缓存已经闭合。执行这些命令不要求必须使用 root,但执行账号必须有权访问宿主 Docker API 并管理 runner 容器;没有该权限时交给 runner 运维人员执行。
|
||||
|
||||
runner 配置保留原 `ubuntu-latest` 映射,`genarrative-ci` 继续映射到经 `build / verify / load-runner` 验证并写入配置的完整 Image ID。内层 Docker 数据必须持久化,`force_pull` 保持 `false`;该精确 Image ID 在内层不存在时 job 应直接失败,不回退到浮动 tag 或现场拉取。四个 job 使用镜像内 `genarrative-gitea-checkout` 直接从当前 Gitea 拉取事件 commit,带 5 次有界重试,不再运行时下载 GitHub checkout action;随后以 `GENARRATIVE_GITEA_CI_CHECK_RUNTIME=1` 执行 `scripts/check-gitea-ci-job-image.sh`,同时校验工具链、一份 npm workspace 缓存锁、三份 Cargo 缓存锁、bwrap 和 Chrome headless。锁不匹配时校验会输出 `partial` 和醒目的 Actions warning,提示在可信分支落地后刷新镜像。各 job 仍各自运行一次干净的根 `npm ci`,以唯一 workspace lock 校验全部 App/package/tool 依赖并隔离 PR 依赖;统一通过 `scripts/ci-npm-ci-with-retry.sh` 最多执行 3 次整命令级有界重试,并使用镜像内 npm cache 和 `prefer-offline`。锁文件新增依赖时允许经受控网络补齐,本阶段不启用共享 Actions cache。
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ ENV CARGO_HTTP_MULTIPLEXING=false \
|
||||
COPY server-rs /tmp/genarrative-cargo-cache/server-rs
|
||||
COPY apps/desktop-shell/src-tauri /tmp/genarrative-cargo-cache/desktop-shell
|
||||
COPY apps/ai-game-creator-shell/src-tauri /tmp/genarrative-cargo-cache/apps/ai-game-creator-shell/src-tauri
|
||||
COPY plugins/agc-cocos-editor/native/cocos-editor-bridge /tmp/genarrative-cargo-cache/plugins/agc-cocos-editor/native/cocos-editor-bridge
|
||||
COPY plugins/agc-unity-editor/native/unity-editor-bridge /tmp/genarrative-cargo-cache/plugins/agc-unity-editor/native/unity-editor-bridge
|
||||
COPY plugins/agc-godot-editor/native/godot-editor-bridge /tmp/genarrative-cargo-cache/plugins/agc-godot-editor/native/godot-editor-bridge
|
||||
|
||||
RUN find /tmp/genarrative-cargo-cache -name Cargo.toml -exec dirname {} \; \
|
||||
| while IFS= read -r crate_dir; do \
|
||||
@@ -57,12 +60,12 @@ FROM ${RUNNER_IMAGE}
|
||||
ARG NODE_VERSION=22.23.1
|
||||
ARG NODE_LINUX_X64_SHA256=9749e988f437343b7fa832c69ded82a312e41a03116d766797ac14f6f9eee578
|
||||
ARG NPM_VERSION=10.9.7
|
||||
ARG GOOGLE_CHROME_VERSION=150.0.7871.181-1
|
||||
ARG GOOGLE_CHROME_VERSION=153.0.8010.52-1
|
||||
ARG GOOGLE_LINUX_SIGNING_KEY_FINGERPRINT=EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796
|
||||
|
||||
LABEL org.opencontainers.image.title="Genarrative Gitea CI job image" \
|
||||
org.opencontainers.image.description="Ubuntu 24.04 CI image with fixed toolchains and prewarmed npm/Cargo caches" \
|
||||
org.opencontainers.image.version="2026.09.20.1"
|
||||
org.opencontainers.image.version="2026.09.20.2"
|
||||
|
||||
RUN test "$(dpkg --print-architecture)" = "amd64" \
|
||||
&& find /etc/apt/sources.list.d -maxdepth 1 -type f \
|
||||
@@ -120,12 +123,8 @@ RUN node_archive="node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
||||
--strip-components=1 \
|
||||
--directory /usr/local/lib/genarrative-node \
|
||||
&& rm -f "${node_archive}" \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/node /usr/local/bin/node \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/npm /usr/local/bin/npm \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/npx /usr/local/bin/npx \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/corepack /usr/local/bin/corepack \
|
||||
&& npm install --global "npm@${NPM_VERSION}" --no-audit --no-fund \
|
||||
&& test "$(npm --version)" = "${NPM_VERSION}"
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/corepack /usr/local/bin/corepack
|
||||
|
||||
COPY --from=rust-dependency-cache /usr/local/cargo /usr/local/cargo
|
||||
COPY --from=rust-dependency-cache /usr/local/rustup /usr/local/rustup
|
||||
@@ -150,6 +149,8 @@ COPY apps/desktop-shell/src-tauri/Cargo.lock /usr/local/share/genarrative-ci/loc
|
||||
COPY apps/ai-game-creator-shell/src-tauri/Cargo.lock /usr/local/share/genarrative-ci/locks/ai-game-creator-shell.Cargo.lock
|
||||
COPY deploy/container/gitea-ci-checkout.sh /usr/local/bin/genarrative-gitea-checkout
|
||||
|
||||
# npm registry 偶发 ECONNRESET,镜像预热也需要整命令级有界重试;
|
||||
# 失败重试复用同一 npm cache,不会重复下载已完成的包。
|
||||
RUN test -n "${NPM_LOCK_SHA256}" \
|
||||
&& test -n "${SERVER_RUST_LOCK_SHA256}" \
|
||||
&& test -n "${DESKTOP_RUST_LOCK_SHA256}" \
|
||||
@@ -171,12 +172,23 @@ RUN test -n "${NPM_LOCK_SHA256}" \
|
||||
/usr/local/share/genarrative-ci/locks/ai-game-creator-shell.Cargo.lock \
|
||||
| sha256sum --check --strict \
|
||||
&& chmod 0755 /usr/local/bin/genarrative-gitea-checkout \
|
||||
&& npm ci \
|
||||
--ignore-scripts \
|
||||
--no-audit \
|
||||
--no-fund \
|
||||
--prefer-offline \
|
||||
--prefix /usr/local/share/genarrative-ci/npm \
|
||||
&& npm_ci_with_retry() { \
|
||||
for attempt in 1 2 3 4 5; do \
|
||||
if npm ci \
|
||||
--ignore-scripts \
|
||||
--no-audit \
|
||||
--no-fund \
|
||||
--prefer-offline \
|
||||
--prefix /usr/local/share/genarrative-ci/npm; then \
|
||||
return 0; \
|
||||
fi; \
|
||||
if [ "${attempt}" -eq 5 ]; then \
|
||||
return 1; \
|
||||
fi; \
|
||||
sleep "$((attempt * 5))"; \
|
||||
done; \
|
||||
} \
|
||||
&& npm_ci_with_retry \
|
||||
&& rm -rf \
|
||||
/usr/local/share/genarrative-ci/npm/node_modules \
|
||||
/usr/local/share/genarrative-ci/npm/apps/*/node_modules \
|
||||
@@ -184,6 +196,28 @@ RUN test -n "${NPM_LOCK_SHA256}" \
|
||||
/usr/local/share/genarrative-ci/npm/tools/*/node_modules \
|
||||
&& npm cache verify
|
||||
|
||||
# 依赖预热会在 workspace 内解析出 Node 发行包自带的 npm(例如 10.9.8),
|
||||
# 并通过 PATH 里的 node_modules/.bin 影子化固定版本,因此全局固定版本在预热之后安装。
|
||||
# 基础 runner 镜像把 /opt/acttoolcache/node/24.18.0/x64/bin 放在 PATH 最前,
|
||||
# 会影子化固定 Node / npm。这里把固定工具链写成绝对路径 wrapper,
|
||||
# 并用同一组 wrapper 覆盖 base 镜像残留的 toolcache bin,避免 shell 是否登录改变解析结果。
|
||||
RUN npm install --global --prefix /usr/local/lib/genarrative-node \
|
||||
--no-audit --no-fund "npm@${NPM_VERSION}" \
|
||||
&& test "$(/usr/local/lib/genarrative-node/bin/node /usr/local/lib/genarrative-node/lib/node_modules/npm/bin/npm-cli.js --version)" = "${NPM_VERSION}" \
|
||||
&& rm -f /usr/local/bin/npm \
|
||||
&& printf '%s\n' '#!/bin/sh' \
|
||||
'exec /usr/local/lib/genarrative-node/bin/node /usr/local/lib/genarrative-node/lib/node_modules/npm/bin/npm-cli.js "$@"' \
|
||||
> /usr/local/bin/npm \
|
||||
&& chmod 0755 /usr/local/bin/npm \
|
||||
&& rm -rf /opt/acttoolcache/node/24.18.0/x64/bin \
|
||||
&& mkdir -p /opt/acttoolcache/node/24.18.0/x64/bin \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/node /opt/acttoolcache/node/24.18.0/x64/bin/node \
|
||||
&& ln -sfn /usr/local/bin/npm /opt/acttoolcache/node/24.18.0/x64/bin/npm \
|
||||
&& ln -sfn /usr/local/lib/genarrative-node/bin/npx /opt/acttoolcache/node/24.18.0/x64/bin/npx \
|
||||
&& test "$(readlink -f "$(command -v node)")" = "/usr/local/lib/genarrative-node/bin/node" \
|
||||
&& test "$(node --version)" = "v${NODE_VERSION}" \
|
||||
&& test "$(npm --version)" = "${NPM_VERSION}"
|
||||
|
||||
RUN install -m 0755 /usr/local/cargo/bin/rustup /usr/local/bin/rustup \
|
||||
&& for command_name in cargo cargo-fmt rustc rustdoc rustfmt; do \
|
||||
ln -sfn rustup "/usr/local/bin/${command_name}"; \
|
||||
@@ -208,7 +242,7 @@ ENV CARGO_HOME=/usr/local/cargo \
|
||||
|
||||
ARG IMAGE_REVISION=uncommitted
|
||||
LABEL org.opencontainers.image.vendor="GenarrativeAI" \
|
||||
org.opencontainers.image.version="2026.09.20.1" \
|
||||
org.opencontainers.image.version="2026.09.20.2" \
|
||||
org.opencontainers.image.source="https://git.genarrative.world/GenarrativeAI/Genarrative" \
|
||||
org.opencontainers.image.revision="${IMAGE_REVISION}" \
|
||||
org.opencontainers.image.base.name="docker.gitea.com/runner-images:ubuntu-latest@sha256:58ea92624c7c09582e05594d95488331045053d3a3f34cf09649f2a32313a614" \
|
||||
|
||||
@@ -38,3 +38,14 @@
|
||||
!tools/
|
||||
!tools/spine-json-export-validator/
|
||||
!tools/spine-json-export-validator/package.json
|
||||
!plugins/
|
||||
!plugins/agc-cocos-editor/
|
||||
!plugins/agc-cocos-editor/native/
|
||||
!plugins/agc-cocos-editor/native/cocos-editor-bridge/
|
||||
!plugins/agc-unity-editor/
|
||||
!plugins/agc-unity-editor/native/
|
||||
!plugins/agc-unity-editor/native/unity-editor-bridge/
|
||||
!plugins/agc-godot-editor/
|
||||
!plugins/agc-godot-editor/native/
|
||||
!plugins/agc-godot-editor/native/godot-editor-bridge/
|
||||
!plugins/agc-*-editor/native/*-editor-bridge/**
|
||||
|
||||
Reference in New Issue
Block a user