Route realcombo git subprocesses through the trusted base in CI
ci / svc-realcombo (pull_request) Failing after 1m58s
ci / test-pg (pull_request) Successful in 2m28s
ci / test (pull_request) Successful in 4m15s

Why: on keyless runners the RDM cache clone and pins materialization
inside svc.sh fetched nested pins over raw SSH URLs (run 2608: host key
verification failed); the suite now injects the same URL-scoped token
header and insteadOf rewrite via environment when SVC_CI_GIT_* is set.
Evidence: local rerun stays green (env unset locally); CI run applies it.
Impact: tests + ci.yaml only; token travels via environment only.
This commit is contained in:
2026-10-12 14:40:14 +00:00
parent 2c767867ca
commit 139fda0fe3
2 changed files with 28 additions and 0 deletions
+5
View File
@@ -616,6 +616,8 @@ jobs:
unset SUBMODULE_TOKEN
make -C rdm build
- name: Run real-combination lifecycle gates (SQLite, U3, required)
env:
SUBMODULE_TOKEN: ${{ secrets.SUBMODULE_TOKEN }}
run: |
set -euo pipefail
# 路径变量在脚本内解析(YAML env: 不做 shell 展开)。
@@ -623,4 +625,7 @@ jobs:
export SVC_REAL_BIN="$PWD/bin/agent-system"
export SVC_REAL_RDM_BIN="$PWD/rdm/bin/agent-system-rdm"
export SVC_RDM_ORIGIN="$PWD/rdm"
# CI 无 SSH key:把受信基址与 URL 级 token 头经环境交给套件(仅环境传递)。
export SVC_CI_GIT_SERVER="${GITHUB_SERVER_URL%/}"
export SVC_CI_GIT_TOKEN="${SUBMODULE_TOKEN}"
python3 -m unittest tests.test_svc_realcombo -v
+23
View File
@@ -31,6 +31,28 @@ REAL = os.environ.get("SVC_TEST_REAL") == "1"
REAL_BIN = os.environ.get("SVC_REAL_BIN", "")
REAL_RDM_BIN = os.environ.get("SVC_REAL_RDM_BIN", "")
RDM_ORIGIN = os.environ.get("SVC_RDM_ORIGIN", "")
# CI 通道(可选):无 SSH key 的运行器上,把受信基址 + URL 级 token 头注入
# svc.sh 派生的 git 子进程(cache 克隆与 pins 物化的 submodule 取件走 SSH URL
# 会被 insteadOf 改写)。token 只经环境传递,不进文件/命令行/输出。
CI_SERVER = os.environ.get("SVC_CI_GIT_SERVER", "").rstrip("/")
CI_TOKEN = os.environ.get("SVC_CI_GIT_TOKEN", "")
def ci_git_env():
if not (CI_SERVER and CI_TOKEN):
return {}
scheme = CI_SERVER.split("://", 1)[0]
return {
"GIT_CONFIG_COUNT": "4",
"GIT_CONFIG_KEY_0": "protocol.%s.allow" % scheme,
"GIT_CONFIG_VALUE_0": "always",
"GIT_CONFIG_KEY_1": "http.%s/.extraheader" % CI_SERVER,
"GIT_CONFIG_VALUE_1": "AUTHORIZATION: token " + CI_TOKEN,
"GIT_CONFIG_KEY_2": "url.%s/weichen/.insteadOf" % CI_SERVER,
"GIT_CONFIG_VALUE_2": "ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/",
"GIT_CONFIG_KEY_3": "core.hooksPath",
"GIT_CONFIG_VALUE_3": "/dev/null",
}
PG = os.environ.get("SVC_TEST_PG") == "1" and bool(os.environ.get("AGENT_PG_TEST_DSN"))
_spec = importlib.util.spec_from_file_location("tsr", SOURCE / "tests" / "test_svc_recover.py")
@@ -154,6 +176,7 @@ class RealComboTests(tsr.SvcAutoRecoverTests):
伴生工作台 200 → 裸重启稳定。"""
env = dict(self.env)
env["RDM_DISABLE_EXEC_TOOLS"] = "1"
env.update(ci_git_env())
env.update({"SVC_RDM_SRC_DIR": str(self.root / "rdmcache"),
"SVC_RDM_ORIGIN": RDM_ORIGIN})
result = self.svc("rcf", "deploy", "--from", "rdm", "--port", "9474", env=env)