[需求] CI容器通用化k8s错误反馈机制-补充优化-的开发实现-runner-container-hooks部分#22
[需求] CI容器通用化k8s错误反馈机制-补充优化-的开发实现-runner-container-hooks部分#22flysky22222 wants to merge 6 commits into
Conversation
…vent exitCode=0 false positives
… guard, refactor describePodFailure for pre-fetched pod
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Welcome To opensourceways CommunityHey @flysky22222 , 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 Passflysky22222, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
…d exitCode guard and preFetchedPod optimization
CLA Signature Passflysky22222, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
…ith 2-arg call signature
NotificationThis pull request source branch has changed, so removes the following label(s): gate_check_pass. |
CLA Signature Passflysky22222, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
…rectly for 422 error formatting
NotificationThis pull request source branch has changed, so removes the following label(s): gate_check_pass. |
CLA Signature Passflysky22222, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
NotificationThis pull request source branch has changed, so removes the following label(s): gate_check_pass. |
CLA Signature Passflysky22222, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
|||||||||||||||||
背景
[需求] CI容器通用化k8s错误反馈机制-补充优化(runner-container-hooks)· 开发流水线 · 开发预览阶段(代码已推 + 预览已部署 + UT 已补;门禁/对抗由 PR CI 异步跑)
改动内容
fix(runner-container-hooks): eliminate module shadowing, add exitCode guard, refactor describePodFailure for pre-fetched pod
Changes in runner-container-hooks submodule
1. Delete
packages/k8s/src/k8s/utils.ts(TS compile fix)utils.tsfile shadowed theutils/index.tsdirectory, preventing TypeScript from resolving new exports (EXTERNALS_VOLUME_NAME, GITHUB_VOLUME_NAME, WORK_VOLUME, CONTAINER_VOLUMES, sleep, listDirAllCommand, prepareJobScript, writeRunScript, writeContainerStepScript). This caused 12 compile errors and 8/9 test suite failures../utilsand../k8s/utilsnow correctly resolve toutils/index.ts.2. Add
exitCode !== 0guard togetContainerTerminatedErrors(false positive fix)packages/k8s/src/k8s/index.ts:798: Changed condition fromterminated?.reason && unrecoverableReasons.has(terminated.reason)toterminated?.reason && terminated.exitCode !== 0 && unrecoverableReasons.has(terminated.reason).describePodFailureline 939 which already checksexitCode !== 0.3. Refactor
describePodFailureto acceptpreFetchedPod(redundant API call elimination)packages/k8s/src/k8s/index.ts:887: Changed signature from(podName: string)to(podName: string, preFetchedPod?: k8s.V1Pod).preFetchedPodis provided, skips thereadPod(podName)API call and uses the pre-fetched pod directly, avoiding redundant K8s API calls that fetch the same pod resource twice.4. Update
run-container-step.tsto pass pre-fetched podpackages/k8s/src/hooks/run-container-step.ts:126: ChangeddescribePodFailure(podName)todescribePodFailure(podName, pod), passing the pod already fetched bygetPodByNameon line 123.5. Update
waitForPodPhasesto pass pre-fetched pod to alldescribePodFailurecallspackages/k8s/src/k8s/index.ts:1029, 1054, 1066: All threedescribePodFailure(podName)calls inwaitForPodPhasesnow pass the pod fetched byreadPodon line 1020 as the second argument.6. Move
utils/index.spec.tstotests/utils-test.ts.spec.tsnaming didn't match the JesttestMatch: ['**/*-test.ts']pattern, so the file was never executed bynpm test. Moved and renamed totests/utils-test.tswith corrected import paths.UT files added/modified
packages/k8s/tests/wait-for-pod-phases-test.tsdoes not flag containers with unrecoverable reason but exitCode=0 (false positive guard)— verifiesgetContainerTerminatedErrorsreturns empty when reason='Error' + exitCode=0skips readPod when preFetchedPod is provided— verifiesdescribePodFailurewithpreFetchedPoddoes not callreadNamespacedPodspypackages/k8s/tests/run-container-step-terminated-test.tspasses pre-fetched pod to describePodFailure to avoid redundant API call— verifiesdescribePodFailureSpyis called with(podName, podObj)not just(podName)describePodFailurereceives the pre-fetched pod as second argumentpackages/k8s/tests/utils-test.ts(moved fromsrc/k8s/utils/index.spec.ts)../src/k8s/utilsVerification
npm run build --prefix packages/k8s: TS compile + ncc bundle succeeds (0 errors)相关 Issue
resolve https://github.com/opensourceways/backlog/issues/1203
AI 使用声明
当前 PR 是否有 AI 参与:
/ai-develop-preview