CI Flake Triage
Use this skill to turn noisy JUnit retry artifacts into a focused flaky-test report.
What this skill does
- - Reads one or more JUnit XML files (for example: first run + rerun artifacts)
- Aggregates status per test case (
passed, failed, skipped, error) - Flags flaky candidates when a test has both fail-like and pass outcomes
- Separates persistent failures from flaky failures
- Prints top flaky tests to prioritize stabilization work
Inputs
Optional:
- -
JUNIT_GLOB (default: test-results/**/*.xml) - INLINECODE6 (default:
20) - INLINECODE8 (
text or json, default: text) - INLINECODE12 (
0 or 1, default: 0) — exit non-zero when persistent failures exist - INLINECODE16 (
0 or 1, default: 0) — exit non-zero when flaky candidates exist
Run
Text report:
CODEBLOCK0
JSON output for CI ingestion:
CODEBLOCK1
Run with bundled fixtures:
CODEBLOCK2
Output contract
- - Exit
0 when no fail gates are enabled (default) - Exit
1 if FAIL_ON_PERSISTENT=1 and persistent failures are found - Exit
1 if FAIL_ON_FLAKE=1 and flaky candidates are found - In
text mode, prints summary + top flaky + persistent failures - In
json mode, prints machine-readable summary and testcase details
CI Flake 分类
使用此技能将杂乱的 JUnit 重试产物转化为聚焦的测试不稳定报告。
本技能功能
- - 读取一个或多个 JUnit XML 文件(例如:首次运行 + 重试产物)
- 按测试用例聚合状态(passed、failed、skipped、error)
- 当测试同时出现失败和通过结果时,标记为不稳定候选
- 区分持续失败与不稳定失败
- 打印最不稳定的测试项,优先进行稳定性修复
输入参数
可选参数:
- - JUNITGLOB(默认值:test-results//*.xml)
- TRIAGETOP(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- FAILONPERSISTENT(0 或 1,默认值:0)— 存在持续失败时返回非零退出码
- FAILON_FLAKE(0 或 1,默认值:0)— 存在不稳定候选时返回非零退出码
运行方式
文本报告:
bash
JUNIT_GLOB=artifacts/junit//*.xml \
TRIAGE_TOP=15 \
bash skills/ci-flake-triage/scripts/triage-flakes.sh
供 CI 系统使用的 JSON 输出:
bash
JUNIT_GLOB=artifacts/junit//*.xml \
OUTPUT_FORMAT=json \
FAILONPERSISTENT=1 \
bash skills/ci-flake-triage/scripts/triage-flakes.sh
使用内置测试数据运行:
bash
JUNIT_GLOB=skills/ci-flake-triage/fixtures/*.xml \
bash skills/ci-flake-triage/scripts/triage-flakes.sh
输出约定
- - 当未启用任何失败门控时,退出码为 0(默认情况)
- 若 FAILONPERSISTENT=1 且发现持续失败,退出码为 1
- 若 FAILONFLAKE=1 且发现不稳定候选,退出码为 1
- 在 text 模式下,打印摘要 + 最不稳定项 + 持续失败项
- 在 json 模式下,打印机器可读的摘要和测试用例详情