Skip to content

Commit df22dbd

Browse files
committed
introduce support for interacting with ad querying
polarion.
1 parent f71e9be commit df22dbd

File tree

11 files changed

+5552
-0
lines changed

11 files changed

+5552
-0
lines changed

.claude-plugin/marketplace.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@
7878
"name": "hcp",
7979
"source": "./plugins/hcp",
8080
"description": "Generate HyperShift cluster creation commands via hcp CLI from natural language descriptions"
81+
},
82+
{
83+
"name": "polarion",
84+
"source": "./plugins/polarion",
85+
"description": "Polarion test management integration and test case tracking for OpenShift projects"
8186
}
8287
]
8388
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "polarion",
3+
"description": "Utilities and commands for interacting with Polarion",
4+
"version": "0.0.1",
5+
"author": {
6+
"name": "github.com/openshift-eng"
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "polarion",
3+
"description": "Polarion test management integration and test case tracking for OpenShift projects",
4+
"version": "0.0.1",
5+
"author": {
6+
"name": "github.com/openshift-eng"
7+
}
8+
}

plugins/polarion/README.md

Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
# Polarion Plugin
2+
3+
Polarion test management integration and test case tracking for OpenShift projects. This plugin provides comprehensive access to Polarion test data, project discovery, and test execution activity tracking through Claude Code slash commands.
4+
5+
## Commands
6+
7+
### `/polarion:activity`
8+
9+
Generate comprehensive test activity reports across OpenShift projects, tracking test runs, test cases, and contributor activity.
10+
11+
### `/polarion:projects`
12+
13+
Discover and list OpenShift-related projects in Polarion with advanced filtering capabilities.
14+
15+
### `/polarion:test-runs`
16+
17+
Analyze test runs for specific projects with detailed filtering and export options.
18+
19+
### `/polarion:health-check`
20+
21+
Perform health checks on Polarion connectivity and project accessibility.
22+
23+
### `/polarion:weekly-report`
24+
25+
Generate automated weekly test activity reports for team standup and management.
26+
27+
See the [commands/](commands/) directory for full documentation of each command.
28+
29+
## Installation
30+
31+
### From the Claude Code Plugin Marketplace
32+
33+
1. **Add the marketplace** (if not already added):
34+
```bash
35+
/plugin marketplace add openshift-eng/ai-helpers
36+
```
37+
38+
2. **Install the polarion plugin**:
39+
```bash
40+
/plugin install polarion@ai-helpers
41+
```
42+
43+
3. **Use the commands**:
44+
```bash
45+
/polarion:activity --days-back 7
46+
```
47+
48+
## Prerequisites
49+
50+
Before using this plugin, ensure you have:
51+
52+
1. **Polarion API Token**:
53+
- Get from [Red Hat Polarion](https://polarion.engineering.redhat.com) → User Settings → Security → API Tokens
54+
- Set as environment variable: `export POLARION_TOKEN="your_token_here"`
55+
56+
2. **Network Access**:
57+
- Access to `polarion.engineering.redhat.com`
58+
- Corporate proxy configured if applicable
59+
60+
3. **Project Permissions**:
61+
- Read access to OpenShift-related projects in Polarion
62+
- Minimum permissions for test runs and test cases
63+
64+
## Available Commands
65+
66+
### Test Activity Analysis
67+
68+
#### `/polarion:activity` - Comprehensive Test Activity Reports
69+
70+
Generate detailed test activity reports across OpenShift projects with contributor tracking and project statistics.
71+
72+
**Basic Usage:**
73+
```bash
74+
# Weekly activity summary
75+
/polarion:activity
76+
77+
# Custom timeframe
78+
/polarion:activity --days-back 30
79+
80+
# Focus on specific projects
81+
/polarion:activity --keywords openshift container platform
82+
83+
# Export detailed report
84+
/polarion:activity --output qe-weekly-report.json
85+
```
86+
87+
**Key Features:**
88+
- Cross-project activity correlation
89+
- Test contributor tracking
90+
- Project activity rankings
91+
- Export to JSON/CSV formats
92+
- Time-based trend analysis
93+
94+
**Arguments:**
95+
- `--days-back <days>`: Time period to analyze (default: 7)
96+
- `--project-limit <num>`: Maximum projects to analyze (default: 5)
97+
- `--keywords <words>`: Filter projects by keywords
98+
- `--output <file>`: Export results to file
99+
- `--format <json|csv>`: Output format
100+
- `--verbose`: Detailed output with debug information
101+
102+
**Examples:**
103+
104+
1. Weekly team standup report:
105+
```bash
106+
/polarion:activity --days-back 7 --output weekly-test-activity.json
107+
```
108+
109+
2. Monthly management summary:
110+
```bash
111+
/polarion:activity --days-back 30 --project-limit 10 --output monthly-summary.csv --format csv
112+
```
113+
114+
3. Specific project focus:
115+
```bash
116+
/polarion:activity --keywords "splat" "openshift" --days-back 14
117+
```
118+
119+
### Project Discovery
120+
121+
#### `/polarion:projects` - Discover OpenShift Projects
122+
123+
Search and filter Polarion projects with intelligent keyword matching.
124+
125+
**Basic Usage:**
126+
```bash
127+
# List OpenShift-related projects
128+
/polarion:projects
129+
130+
# Custom keyword search
131+
/polarion:projects --keywords container storage platform
132+
133+
# Export project list
134+
/polarion:projects --output projects.csv --format csv
135+
```
136+
137+
### Test Analysis
138+
139+
#### `/polarion:test-runs` - Analyze Test Runs
140+
141+
Examine test runs for specific projects with detailed filtering.
142+
143+
**Basic Usage:**
144+
```bash
145+
# Recent test runs for project
146+
/polarion:test-runs SPLAT
147+
148+
# Custom timeframe and limit
149+
/polarion:test-runs OPENSHIFT --days-back 30 --limit 50
150+
151+
# Export test run data
152+
/polarion:test-runs SPLAT --output splat-runs.json
153+
```
154+
155+
### Health and Diagnostics
156+
157+
#### `/polarion:health-check` - Connection and Access Validation
158+
159+
Verify Polarion connectivity and project access permissions.
160+
161+
**Basic Usage:**
162+
```bash
163+
# Basic health check
164+
/polarion:health-check
165+
166+
# Detailed diagnostics
167+
/polarion:health-check --verbose
168+
```
169+
170+
#### `/polarion:weekly-report` - Automated Weekly Reports
171+
172+
Generate formatted weekly reports optimized for team communication.
173+
174+
**Basic Usage:**
175+
```bash
176+
# Standard weekly report
177+
/polarion:weekly-report
178+
179+
# Custom team focus
180+
/polarion:weekly-report --keywords openshift --output weekly-team-report.md --format markdown
181+
```
182+
183+
## Integration Workflows
184+
185+
This plugin is designed to integrate with existing QE and development workflows:
186+
187+
### With Team Standup
188+
189+
```bash
190+
# Generate quick weekly summary for standup
191+
/polarion:activity --days-back 7 --project-limit 3
192+
193+
# Export for sharing with team
194+
/polarion:weekly-report --output standup-$(date +%Y%m%d).json
195+
```
196+
197+
### With Management Reporting
198+
199+
```bash
200+
# Monthly comprehensive analysis
201+
/polarion:activity --days-back 30 --project-limit 10 --output monthly-qe-metrics.csv --format csv
202+
203+
# Project health overview
204+
/polarion:projects --keywords openshift --output project-status.json
205+
```
206+
207+
### With CI/CD Pipelines
208+
209+
```bash
210+
# Health check in deployment pipeline
211+
/polarion:health-check || echo "WARNING: Polarion connectivity issues"
212+
213+
# Automated weekly reports
214+
/polarion:weekly-report --output reports/weekly-$(date +%Y%m%d).json
215+
```
216+
217+
## Configuration
218+
219+
### Environment Variables
220+
- `POLARION_TOKEN`: API authentication token (required)
221+
- `POLARION_BASE_URL`: Custom Polarion instance URL (optional, defaults to Red Hat Polarion)
222+
- `HTTPS_PROXY`: Corporate proxy configuration (if needed)
223+
224+
### Default Behavior
225+
- **Default timeframe**: 7 days
226+
- **Default project limit**: 5 projects
227+
- **Default keywords**: `["openshift", "splat", "ocp", "platform", "container"]`
228+
- **Default output format**: JSON
229+
230+
## Troubleshooting
231+
232+
### Authentication Issues
233+
```bash
234+
# Test token validity
235+
/polarion:health-check
236+
237+
# Common fixes:
238+
# 1. Regenerate token in Polarion UI
239+
# 2. Verify POLARION_TOKEN environment variable
240+
# 3. Check network connectivity
241+
```
242+
243+
### Empty Results
244+
```bash
245+
# Debug with verbose output
246+
/polarion:activity --verbose
247+
248+
# Common causes:
249+
# 1. Insufficient project permissions
250+
# 2. No activity in specified timeframe
251+
# 3. Project keyword filters too restrictive
252+
```
253+
254+
### Performance Issues
255+
```bash
256+
# Optimize queries
257+
/polarion:activity --project-limit 3 --days-back 7
258+
259+
# For large datasets, use incremental approach
260+
/polarion:activity --days-back 14 --output batch1.json
261+
/polarion:activity --days-back 14 --keywords specific-project --output batch2.json
262+
```
263+
264+
## Error Handling
265+
266+
The plugin includes comprehensive error handling:
267+
268+
- **Authentication**: Clear messages for token issues with resolution steps
269+
- **Network**: Retry logic with exponential backoff for transient failures
270+
- **Rate Limiting**: Automatic handling with courtesy delays
271+
- **Permissions**: Informative errors for insufficient access rights
272+
- **Data Validation**: Robust parsing with fallbacks for malformed responses
273+
274+
## Security Considerations
275+
276+
- **Token Storage**: Never commit API tokens to version control
277+
- **Data Handling**: Reports may contain sensitive project information
278+
- **Network Security**: All communications use HTTPS with Red Hat Polarion
279+
- **Access Control**: Plugin respects Polarion RBAC and project permissions
280+
281+
## Related Plugins
282+
283+
- **jira** - JIRA integration for correlating test results with issues
284+
- **ci** - OpenShift CI integration for test failure analysis
285+
- **prow-job** - Prow job analysis for CI/CD correlation
286+
- **component-health** - Component health analysis across releases
287+
288+
## Development
289+
290+
### Adding New Commands
291+
292+
To add a new command to this plugin:
293+
294+
1. Create a new markdown file in `commands/`:
295+
```bash
296+
touch plugins/polarion/commands/your-command.md
297+
```
298+
299+
2. Follow the structure from existing commands (see `commands/activity.md` for reference)
300+
301+
3. Include these sections:
302+
- Name, Synopsis, Description
303+
- Prerequisites and Arguments
304+
- Implementation details
305+
- Examples and Return Value
306+
- Error Handling and Notes
307+
308+
4. Test your command:
309+
```bash
310+
/polarion:your-command
311+
```
312+
313+
### Plugin Structure
314+
315+
```
316+
plugins/polarion/
317+
├── .claude-plugin/
318+
│ └── plugin.json # Plugin metadata
319+
├── commands/
320+
│ ├── activity.md # QE activity analysis
321+
│ ├── projects.md # Project discovery
322+
│ ├── test-runs.md # Test run analysis
323+
│ ├── health-check.md # Connection diagnostics
324+
│ └── weekly-report.md # Weekly reporting
325+
├── skills/ # Optional: Complex implementations
326+
│ └── polarion-client/
327+
│ ├── SKILL.md # Detailed client usage
328+
│ └── polarion_client.py # Reference client
329+
└── README.md # This file
330+
```
331+
332+
## Contributing
333+
334+
Contributions are welcome! When adding new Polarion-related commands:
335+
336+
1. Ensure the command is specific to QE/testing workflows
337+
2. Follow the existing command structure and documentation format
338+
3. Include comprehensive examples and error handling
339+
4. Test with real Polarion projects
340+
5. Update this README with new command documentation
341+
342+
## License
343+
344+
See [LICENSE](../../LICENSE) for details.

0 commit comments

Comments
 (0)