Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions plugins/prow-job/commands/list-qe-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
description: list all CI jobs
argument-hint: bearer-token keywords
---

## Name
/prow-job:list-jobs

## Synopsis
Generate a report showing all openshift qe ci jobs:
```
/prow-job:list-jobs
```
Generate a report showing all openshift qe ci jobs with given words in job name:
```
/prow-job:list-jobs [name]
```

## Description
Openshift QE often needs to debug ci job failures, get fault trends, the first step is to get job names and job links.

## Implementation
Pass the user's request to the skill, which will:
- Load environment variable "bearer"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefix this with a convention that avoid clashing with other processes e.g. LIST_QE_JOBS_BEARER

- If environment variable "bearer" is not given, output error and stop the skill
- Go to https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/prowjobs.js?var=allBuilds&omit=annotations,labels,decoration_config,pod_spec page with above environment variable bearer and list all [spec/job, status/url, status/state] in the respond json.
- Accepts an optional name argument ($1)
- If $1 is provided, "$1" is a space-delimited list of words, outputs all jobs which name contains each word in "$1"
- If no argument is provided, outputs all jobs
- Get all job names and URL
- Generate an interactive HTML report with timeline visualization which can filter jobs by job name
- The command is stateless and has no side effects

The skill handles all the implementation details including extract data from URL and HTML report generation.
85 changes: 85 additions & 0 deletions plugins/prow-job/skills/prow-job-list-qe-jobs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Prow Job List Job Skill

This skill list all Prow CI jobs by accessing https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/prowjobs.js?var=allBuilds&omit=annotations,labels,decoration_config,pod_spec.

## Overview

The skill provides a Claude Code skill interface for listing Prow CI jobs. It helps get current test coverage and job status.

## Components

### 1. SKILL.md
Claude Code skill definition that provides detailed implementation instructions for the AI assistant.

### 2. Python Scripts

#### generate_report.py
Generates interactive HTML reports from parsed job data.
- Get job data from https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/prowjobs.js?var=allBuilds&omit=annotations,labels,decoration_config,pod_spec
- Fill job data into html
- Creates interactive timeline visualization
- Adds filtering and search capabilities

**Usage:**
```bash
python3 plugins/prow-job/skills/prow-job-list-qe-jobs/generate_report.py \
-t .work/prow-job-list-qe-jobs/template.html \
-d .work/prow-job-list-qe-jobs/all_jobs.json \
-o .work/prow-job-list-qe-jobs/prow_jobs_report.html \
-k "{KEYWORDS}"
```

### 3. HTML Template

#### template.html
Modern, responsive HTML template for reports featuring:
- Color-coded job state
- Filtering by job state
- Search functionality
- Mobile-responsive design

## Prerequisites

1. **Python 3** - For running parser and report generator scripts

## Workflow

1. **Get Data**
- Access https://console-openshift-console.apps.ci.l2s4.p1.openshiftapps.com/topology/all-namespaces?view=graph
- Extract [spec/job, status/url, status/state] from the respond json

2. **Report Generation**
- Render HTML with template
- Output to `.work/prow-job-list-qe-jobs/prow_jobs_report.html`

## Output

### HTML Report
- Header with metadata
- Filterable job entries
- Search functionality

### Directory Structure
```
.
└── prow-job-list-qe-jobs
├── all_jobs_items.json
├── all_jobs.json
├── all_jobs_raw.js
├── prow_jobs_report.html
└── template.html
```

## Using with Claude Code

When you ask Claude to list Prow jobs, it will automatically use this skill. The skill provides detailed instructions that guide Claude through:
- Give Bearer token
- Give keywords if needed
- Generating reports

You can simply ask:
> "List all prow jobs which name contains release-4.21 and upgrade"
Or
> /prow-job:list-qe-jobs "release-4.21 upgrade"
Claude will execute the workflow and generate the interactive HTML report.
72 changes: 72 additions & 0 deletions plugins/prow-job/skills/prow-job-list-qe-jobs/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Prow Job list jobs
description: List all jobs for further debugging or analyze
---

# Prow Job list jobs

This skill list all Prow CI jobs by accessing https://qe-private-deck-ci.apps.ci.l2s4.p1.openshiftapps.com/prowjobs.js?var=allBuilds&omit=annotations,labels,decoration_config,pod_spec.

## When to Use This Skill

Use this skill when the user wants to:
- Analyze a batch of CI jobs
- Check which area have been covered

## Prerequisites

Before starting, verify these prerequisites:

1. **Python 3** - For running parser and report generator scripts

## Input Format

The user will provide:
1. **Bearer token** - which can be get from https://console-openshift-console.apps.ci.l2s4.p1.openshiftapps.com/topology/all-namespaces?view=graph
- Example: `sha256~_xxxxxxxxxxxxxxxxxxxx`

2. **Key words** - space-delimited list in format `word1 word2 word3`
- Example: `release-4.21 upgrade`

## Implementation Steps

### Step 1: Parse and Validate URL

1. **Extract job data**
- Access https://console-openshift-console.apps.ci.l2s4.p1.openshiftapps.com/topology/all-namespaces?view=graph
- Extract [spec/job, status/url, status/state] from the respond json

### Step 2: Parse Resource Specifications

For each space-delimited resource spec:

1. **Filter**
- job name should contains all key words in optional keywords parameter

### Step 3: Create Working Directory

2. **Create directory structure**
```bash
mkdir -p .work/prow-job-list-qe-jobs/

### Step 3: Generate HTML Report

**IMPORTANT: Use the provided Python script `generate_report.py` from the skill directory.**

**Usage:**
```bash
python3 plugins/prow-job/skills/prow-job-list-qe-jobs/generate_report.py \
-t .work/prow-job-list-qe-jobs/template.html \
-d .work/prow-job-list-qe-jobs/all_jobs.json \
-o .work/prow-job-list-qe-jobs/prow_jobs_report.html \
-k "{KEYWORDS}"
```

### Step 4: Present Results to User

1. **Open report in browser**
- Detect platform and automatically open the HTML report in the default browser
- Linux: `xdg-open .work/prow-job-list-qe-jobs/prow_jobs_report.html`
- macOS: `open .work/prow-job-list-qe-jobs/prow_jobs_report.html`
- Windows: `start .work/prow-job-list-qe-jobs/prow_jobs_report.html`
- On Linux (most common for this environment), use `xdg-open`
Loading
Loading