-
Couldn't load subscription status.
- Fork 58
Adding a new slash command prow-job:list-qe-jobs #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JianLi-RH
wants to merge
1
commit into
openshift-eng:main
Choose a base branch
from
JianLi-RH:ci_history
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+689
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| - 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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