A skill used for diagnosing failure issues based on the Jenkins Job build link provided by the user.
SaferSkills independently audited jenkins-pipeline-diagnosis (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
此技能用于诊断Jenkins流水线构建失败的原因,通过分析构建日志和测试报告,提供详细的失败诊断报告,帮助用户快速定位和解决构建问题。
scripts/diagnose_jenkins_build.pyjenkins_build_url: 用户提供的Jenkins Job构建链接(例如:https://jenkins.example.com/job/my-job/123/)包含用于与Jenkins API交互和分析日志的脚本:
diagnose_jenkins_build.py: 主诊断脚本,协调整个诊断流程,包括获取构建信息、定位失败阶段、分析失败原因并生成报告jenkins_api.py: 封装Jenkins API工具调用,获取构建结果、阶段信息和日志信息log_analyzer.py: 分析构建日志,识别失败关键字和上下文report_generator.py: 生成诊断报告的工具包含Jenkins API文档和失败模式参考:
jenkins_api_reference.md: Jenkins API使用参考failure_patterns.md: 常见失败模式和解决方案包含诊断报告模板和示例:
report_template.md: 诊断报告模板User Input:
帮我诊断这个Jenkins构建失败的原因:https://jenkins.example.com/job/my-project/456/Expected Output:
# Jenkins构建失败诊断报告
## 基本信息
- Job名称: my-project
- 构建编号: 456
- 构建状态: FAILED
- 构建时间: 2024-01-20 10:30:45
## 失败阶段
- 阶段名称: test
- 开始时间: 2024-01-20 10:25:30
- 结束时间: 2024-01-20 10:30:45
- 持续时间: 5分15秒
## 失败节点
- 阶段名称: test
- 开始时间: 2024-01-20 10:25:30
- 结束时间: 2024-01-20 10:30:45
- 持续时间: 5分15秒
## 失败原因
- 关键字: ERROR
- 上下文: [ERROR] Tests run: 10, Failures: 2, Errors: 0, Skipped: 1 [ERROR] Failed tests: [ERROR] com.example.TestClass.testMethod1 [ERROR] com.example.TestClass.testMethod2
## 测试失败详情
- 测试类: com.example.TestClass
- 失败方法: testMethod1, testMethod2
- 失败原因: 断言失败 - 预期值与实际值不匹配
## 诊断分析
构建失败是由于测试阶段的单元测试失败导致的。具体是TestClass中的两个测试方法断言失败,可能是由于代码变更导致的行为变化。
## 解决方案建议
1. 检查com.example.TestClass中的testMethod1和testMethod2方法
2. 确认最近的代码变更是否影响了这些测试
3. 更新测试用例以匹配新的预期行为,或修复代码以符合测试预期
4. 重新运行构建验证修复结果~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.