构建 Timeout
错误信息
错误: 作业是 取消因为它 exceeded 最大值 timeout
快速摘要
构建 or 测试步骤 exceeds 配置 timeout, causing CI 系统到 取消它.
为什么发生
构建是 genuinely 慢 (大 codebase, heavy compilation)
步骤是 hanging — waiting for 输入, network resource, or lock
timeout 是设置也 低 for workload
Resource constraints (低 CPU, memory) 制作构建慢
最小示例
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5 # too short for large buildjobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30 # more realistic5-minute timeout 是也 短 for 构建. fix increases 它到 30 minutes.
如何诊断
检查流水线 logs for 如何远 构建获取之前 timing out
Review timeout 配置 for 作业
检查如果构建是 hanging on 特定步骤 (network, dependency download)
Compare 构建次数使用上一个 successful 运行
如何修复
Increase timeout for 作业 in 流水线配置
Optimize 构建 (缓存, parallel steps, reduce 作用域)
Fix hanging 步骤 (添加 timeouts 到 network calls, fix deadlocks)
Allocate 更多 resources (CPU, memory) 到 CI runner
如何预防
设置 reasonable timeouts based on historical 构建次数
Use 缓存到 速度上 构建 (dependencies, 构建 artifacts)
Monitor 构建次数 and alert on increasing trends