Agent Skillsray-project/ray › fetch-buildkite-logs

fetch-buildkite-logs

GitHub

该技能用于获取并分析 Buildkite CI 构建日志。通过解析 URL 提取管道和构建号,验证 API 令牌后调用接口查询构建状态、失败作业及详细日志,去除 ANSI 码后总结失败原因并提供修复建议。

.claude/skills/fetch-buildkite-logs/SKILL.md ray-project/ray

Trigger Scenarios

用户询问 CI 构建失败原因 用户提供 Buildkite 链接要求检查日志

Install

npx skills add ray-project/ray --skill fetch-buildkite-logs -g -y
More Options

Non-standard path

npx skills add https://github.com/ray-project/ray/tree/master/.claude/skills/fetch-buildkite-logs -g -y

Use without installing

npx skills use ray-project/ray@fetch-buildkite-logs

指定 Agent (Claude Code)

npx skills add ray-project/ray --skill fetch-buildkite-logs -a claude-code -g -y

安装 repo 全部 skill

npx skills add ray-project/ray --all -g -y

预览 repo 内 skill

npx skills add ray-project/ray --list

SKILL.md

Frontmatter
{
    "name": "fetch-buildkite-logs",
    "description": "Fetch and analyze Buildkite CI build logs for failures"
}

Fetch Buildkite Logs

Prerequisites

  • BUILDKITE_API_TOKEN must be set in the environment (typically ~/.bashrc)
  • If not configured, direct user to doc/source/ray-contribute/agent-development.md for setup

Parsing the Buildkite URL

A Buildkite URL has the form:

https://buildkite.com/ray-project/<PIPELINE>/builds/<BUILD_NUM>#<JOB_ID>

Always extract <PIPELINE> (e.g. premerge, postmerge) and <BUILD_NUM> from the URL the user provides. Do not hardcode premerge — the same skill is used for all pipelines. If a #<JOB_ID> fragment is present, it identifies a specific real job (not a group/wait job) and can be queried directly.

Steps

  1. Verify token: echo $BUILDKITE_API_TOKEN | head -c4
  2. If token missing, stop and show setup instructions from the dev docs
  3. Fetch build (use the pipeline from the URL):
    curl -s -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
      "https://api.buildkite.com/v2/organizations/ray-project/pipelines/<PIPELINE>/builds/<BUILD_NUM>"
    
  4. If a job ID is present in the URL fragment, look it up directly:
    curl -s -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
      "https://api.buildkite.com/v2/organizations/ray-project/pipelines/<PIPELINE>/builds/<BUILD_NUM>" \
      | python3 -c "import sys,json; jobs=json.load(sys.stdin)['jobs']; [print(f\"{j['id']} {j.get('name')} -> {j.get('state')}\") for j in jobs if j['id']=='<JOB_ID>']"
    
  5. Otherwise list failed/broken jobs:
    curl -s -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
      "https://api.buildkite.com/v2/organizations/ray-project/pipelines/<PIPELINE>/builds/<BUILD_NUM>" \
      | python3 -c "import sys,json; jobs=json.load(sys.stdin)['jobs']; [print(f\"{j['id']} {j['name']} -> {j['state']}\") for j in jobs if j.get('state') in ('failed','broken')]"
    
  6. Fetch individual job log:
    curl -s -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
      "https://api.buildkite.com/v2/organizations/ray-project/pipelines/<PIPELINE>/builds/<BUILD_NUM>/jobs/<JOB_ID>/log" \
      > /tmp/log_<JOB_ID>.json
    
    Logs come back as JSON with a content field containing ANSI escape codes — strip them with re.sub(r'\x1b\[[0-9;]*m', '', content) before grepping.
  7. Summarize failures and suggest fixes.

Authentication note

If curl returns {"message":"No organization found"}, the configured token does not have access to ray-project. The user may have a separate org-scoped token — ask them which env var to source.

Version History

  • 3fb63d9 Current 2026-07-25 11:18

Same Skill Collection

.claude/skills/ray-dependencies/SKILL.md
.claude/skills/rebuild/SKILL.md
doc/.claude/skills/ray-soft-wrap/SKILL.md
.claude/skills/lint/SKILL.md
doc/.claude/skills/rst-to-myst/SKILL.md
doc/.claude/skills/sphinx-fix/SKILL.md

Metadata

Files
0
Version
84a62d2
Hash
3fae4dc9
Indexed
2026-07-25 11:18

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 08:59
浙ICP备14020137号-1 $Гость$