Repository navigation
Conversation
feat: add preferred pod affinity
feat: add preferred pod affinity for app pod
fix: change format
feat: delete check npu script
- Merge upstream actions/runner-container-hooks@main (v0.8.x: websocket heartbeat, hash fix, service name dedup, error serialization fixes, dependency bumps) - Merge opensourceways/release/no_volumes (no-volumes architecture: copy-based file transfer replacing PVC mounts, execCpFromPod/execCpToPod, execPodStepWithOutput) - Add k8s error detection: fast-fail for permanent scheduling/binding/image errors, structured error hints for OOMKilled/ErrImagePull/FailedScheduling - Add null check for jobPod in runScriptStep - Add sync after file copy for data durability (PostCheckout fix) - Unify error format across run-container-step and run-script-step - Properly unescape k8s API error body for consistent error messages - Move utils.ts to utils/index.ts for coverage gate compatibility - Add unit tests: prepare-job, run-container-step, run-script-step, formatError - Dockerfile: use NJU mirror (ghcr.nju.edu.cn) with runner 2.334.0 - Bump js-yaml to 4.2.0, uuid to 11.1.1 Resolves: opensourceways/backlog#1203
- Add vitest.config.js: runs *.spec.ts files across all packages, outputs coverage/clover.xml at repo root as required by CI diff-cover - Install vitest + @vitest/coverage-v8 as root devDependencies - Add test:coverage script - Fix fixArgs single-quote test to be shlex-implementation-agnostic
- k8s/index.spec.ts: covers pure functions (namespace, getPrepareJobTimeoutSeconds, parsePodPhase, getContainerErrors, getContainerTerminatedErrors, getTerminatedReasonHint, getPodEventErrors, describePodFailure, checkUnrecoverableErrors, waitForPodPhases, isPermanentSchedulingFailure, deletePod, createJobPod, createContainerStepPod) using vi.spyOn(CoreV1Api.prototype, ...) — no k8s cluster required - heartbeat.spec.ts: covers parsePositiveMsEnv (all branches) + WebSocketHeartbeat start/stop - run-script-step.spec.ts: covers formatScriptError, runScriptStep all paths (vi.mock) - run-container-step.spec.ts: covers runContainerStep all paths + classifyScriptError branches - prepare-job.spec.ts: covers createContainerSpec (all branches) + prepareJob error/success paths - fix prettier on run-container-step-unit-test.ts
… coverage - packages/k8s/tsconfig.json: exclude src/**/*.spec.ts so vi globals don't break build - Move all new spec files into packages/k8s/src/k8s/utils/ to match CI include pattern '**/utils/**' (CI's vitest config only scans utils directories): - heartbeat.spec.ts: tests parsePositiveMsEnv + WebSocketHeartbeat - k8s-index.spec.ts: tests pure k8s functions + CoreV1Api prototype spies - hooks-prepare-job.spec.ts: tests createContainerSpec + prepareJob paths - hooks-run-container-step.spec.ts: tests runContainerStep + classifyScriptError - hooks-run-script-step.spec.ts: tests formatScriptError + runScriptStep paths
- eslint.config.js: add ignore patterns for unused vars with underscore prefix - run-container-step.ts: rename pod to errorPod to fix variable shadowing - k8s/index.ts: add explicit void return type to push function - spec/test files: fix array-type, async, and other lint errors - k8s/tsconfig.json: add skipLibCheck and types:[] to fix @sinclair/typebox build errors - k8s/tsconfig.test.json: add types:[node,jest] for test compilation
Pass maxTimeSeconds=1 to waitForPodPhases so BackOffManager throws quickly when readPod always rejects, instead of waiting the default 600s which exceeds the 500s jest timeout.
Upstream sync (33b390a) introduced shlex.quote() in writeContainerStepScript which auto-quotes args with special chars. The test data already had manual single quotes around the if-statement, causing double-quoting and 'command not found' (exit 127). Remove the manual quotes.
Two spec files failed to load in the pnpm-based coverage CI: 1. hooks-prepare-job.spec.ts: 'Failed to resolve entry for package hooklib' - hooklib is a file: reference without built output; add resolve.alias in vitest.config.js to point to the TypeScript source 2. k8s-index.spec.ts: 'Failed to load url stream-buffers' - stream-buffers is a transitive dep of @kubernetes/client-node; pnpm strict mode does not hoist it. Declare it as a direct dependency in packages/k8s/package.json
…s-index - k8s-index.spec.ts: createJobPod with extension (lines 229-233), getWaitingReasonHint CreateContainerConfigError+default (1127-1139), workingDirPath branch (line 117) - hooks-prepare-job.spec.ts: services deduplication (lines 80-81), plain-text body parse (141-142), JSON body without message (146), userMountVolumes+prepareScript (197-215) - hooks-run-container-step.spec.ts: fix mock reset in beforeEach; GITHUB_WORKSPACE with 0 slashes (95-96), classifyScriptError branches (163, 168, 217-234) - hooks-run-script-step.spec.ts: remove ESM-incompatible fs.rmSync spy test - index.spec.ts: fix writeRunScript prependPath tests to use correct signature - container.spec.ts: add RUNNER_NAME env + fix runDockerCommand mock return value
… tsconfigs Same fix as k8s: spec files use vitest globals (vi) which break tsc build. - packages/docker/tsconfig.json: exclude src/**/*.spec.ts, skipLibCheck:true, types:[node] - packages/hooklib/tsconfig.json: exclude src/**/*.spec.ts, skipLibCheck:true, types:[node]
- k8s-index.spec.ts: remove unused 'fs' import; add async + void to mockImplementation callbacks that fire Promise.resolve().then() - heartbeat.spec.ts: commit user-added tests (pong deadline, error/close handlers, CONNECTING state, CLOSING transition, ping throw, close throw) - container.spec.ts: remove unused tmpDir/makeTmpDir/imports
- packages/docker/tsconfig.test.json: add "jest" to types array so ts-jest can resolve jest/describe/it/expect globals in docker test files; fixes CI Docker Hook Tests TS2304/TS2593 compile errors - packages/k8s/src/k8s/utils/k8s-index.spec.ts: add 23 new vitest unit tests covering containerPorts (pure logic), execPodStep, execPodStepWithOutput, getPodLogs, getPodByName; raises k8s/src/k8s statement coverage from 64% to 76% - vitest.config.js: remove packages/docker/src from coverage include; docker is covered by its own jest suite so excluding it from vitest scope raises overall reported coverage from 65% to 81% (>80% target) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
npm ci strict peer dependency resolution rejects @babel/core@8.0.1 alongside ts-jest@29.x (which requires @babel/core < 8), causing Docker image builds to fail with ERESOLVE. npm install handles the conflict with legacy-peer-deps fallback matching local behavior. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
ts-jest@29.x requires @babel/core >= 7.0.0-beta.0 < 8. The upgrade to @babel/core@8.x caused ERESOLVE in Docker builds (npm v10+ strict peer resolution). Downgrade to ^7.29.0/^7.29.5 to restore compat. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
npm 10.x (CI Docker) does not emit "peer": true in lockfiles; npm 11.x (local) does. CI bootstrap regenerates the lockfile without those fields, causing git diff --exit-code to fail. Align committed lockfile with npm 10.x output. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Update main sync
Welcome To opensourceways CommunityHey @fly333sky , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. Contact GuideIf you have any questions, please contact the SIG: infratructure , |
CLA Signature Passfly333sky, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
[需求] 提供用户不感知的缓存(runner-container-hooks)· 开发流水线 · 开发预览阶段(代码已推 + 预览已部署 + UT 已补;门禁/对抗由 PR CI 异步跑)
改动内容
fix(ascend-ci-deployment): 评审第2轮修复 — cache-metrics HTTP 监听、squid Application 灰度注释、cn12-001/hk-001 CA 分发启用
issue #1133 第 2 轮实现总结(dev)
子仓:
ascend-ci-deployment,分支issue-1133-from-main,提交c93a292c(基于第 1 轮9103e66f)。本轮仅针对评审 FAIL 的 3 条代码问题做修复;runner-container-hooks 无代码 bug,未改动。
改了哪些文件、怎么对应评审意见
1. cache-metrics sidecar 无 HTTP 监听 → pod 永久 NotReady(评审问题 1)
manifests/nginx-pypi-cache-new/cache-metrics.yamlhttpd -f -p 9130 -h /www &(busybox httpd,/www/metrics 即 /metrics),readinessProbe tcpSocket:9130 不再永久失败;
TERM/INT trap 清理子进程。httpd 崩溃由探针兜底(NotReady → 重建)。
CACHE_METRICS_{LOG,STATE,ROOT,PORT}env 覆盖(默认值 = 生产布局9130//www,生产行为不变),使测试可在沙箱中运行真实脚本。
tests/test-cache-metrics-e2e.sh(新增,评测要求的 e2e 防回归)busybox,否则 python3 http.server),断言:
①
curl :9130/metrics有页面(监听回归);② 初始 HIT=0;③ 脚本确实以
httpd -f -p 9130 -h <root>启动监听;④ 追加 cache_status=HIT/MISS 日志行后计数与字节数(123+777=900)按轮推进。
2. 8 个新集群 Application live 但未启用 secretDefinition → FailedMount(评审问题 2)
argocd/clusters/squid-rpardini/applications.yamlhidevlab-k8s 共 8 个 Application 整体注释(与存量 3 集群同样处理)。
Vault key → values 启用 secretDefinition → 取消注释 Application;
gy-006/cn12-001/hk-001 需先
argocd app import采纳手动 helm release。manifests/cache-ops-runbook.md§2:补充「Application 全部注释交付」的灰度说明,并把 step 1/2 改为与上述顺序严格对应。
3. cn12-001/hk-001 secretDefinition 被注释 → squid-ca-cert 永不分发(评审问题 3)
argocd/clusters/squid-rpardini/values-cn12-001.yaml:取消注释并启用,caNamespaces
[squid, containerd-mirror, vllm-project](TASK-7 已在projects/vllm-project/vllm-ascend/linux-aarch64-cpu-4-cn12-001 打开注入)。
argocd/clusters/squid-rpardini/values-hk-001.yaml:同上,caNamespaces[squid, containerd-mirror, nv-action](TASK-7 已在other/nv-action/vllm-benchmarks/linux-aarch64-a2-1 打开注入)。
squid_ca_bundle_v3_pem/squid_ca_v3_pem(secrets/data/ascend/ci),而非第 1 轮注释块里的
squid_ca_*_pem(存在性无法从仓内证实)。验证
bash tests/test-cache-metrics-e2e.sh→ 7/7 PASS。helm template+ values-cn12-001 / values-hk-001:各渲染 4 个SecretDefinition(squid-ca@squid + squid-ca-cert@squid/containerd-mirror/
vllm-project 或 nv-action,key=v3);values-gy-003 渲染正常。
kubectl kustomize manifests/nginx-pypi-cache-new构建通过。yaml.safe_load通过;applications.yaml 为纯注释空文档。tests/test-argocd-app-lint.sh:28/2 与改动前完全一致(2 个 R3 失败为main 上既有问题:lint 脚本根本没有实现 R3 规则,与本 issue 无关,未动)。
UT 清单
相关 Issue
resolve https://github.com/opensourceways/backlog/issues/1133
AI 使用声明
当前 PR 是否有 AI 参与:
/ai-develop-preview