blob: db3eedb627bca7bb386c5325879029b305aa4b34 [file] [log] [blame] [view]
iomodo578f5042025-07-28 20:46:02 +04001# Gerrit Integration Guide
2
3Staff AI Agent System now supports Gerrit as an alternative to GitHub for pull request management. This guide explains how to configure and use Gerrit with Staff.
4
5## Overview
6
7Gerrit integration provides the same capabilities as GitHub:
8- Create changes (Gerrit's equivalent of pull requests)
9- List and manage changes
10- Update change descriptions
11- Close (abandon) changes
12- Submit (merge) changes
13- Structured logging for all operations
14
15## Configuration
16
17### YAML Configuration
18
19Add Gerrit configuration to your `config.yaml`:
20
21```yaml
22# Either GitHub OR Gerrit is required
23gerrit:
24 username: "your-gerrit-username"
25 password: "your-gerrit-http-password-or-token"
26 base_url: "https://gerrit.example.com"
27 project: "your-project-name"
28```
29
30### Environment Variables
31
32You can also configure Gerrit using environment variables:
33
34```bash
35export GERRIT_USERNAME="your-username"
36export GERRIT_PASSWORD="your-password-or-token"
37export GERRIT_BASE_URL="https://gerrit.example.com"
38export GERRIT_PROJECT="your-project"
39```
40
41## Provider Priority
42
43When both GitHub and Gerrit are configured, GitHub takes precedence for backward compatibility. To use Gerrit when both are configured, remove the GitHub configuration.
44
45## Authentication
46
47Gerrit integration supports:
48- **HTTP Password**: Traditional Gerrit HTTP password
49- **HTTP Token**: Generate from Gerrit Settings → HTTP Credentials
50
51## URL Format
52
53Generated change URLs follow Gerrit's standard format:
54```
55https://gerrit.example.com/c/project-name/+/12345
56```
57
58## Agent Behavior
59
60Agents work identically with Gerrit:
611. Process assigned tasks
622. Generate solutions using LLM
633. Create Git branches and commits
644. Create Gerrit changes for review
655. Update task status with change URL
66
67## Configuration Validation
68
69Use the config check command to verify your Gerrit setup:
70
71```bash
72./staff config-check
73```
74
75This will show:
76- Which Git provider is configured (GitHub/Gerrit)
77- Validation of all required fields
78- Connection status
79
80## Example Configuration
81
82See `config-gerrit-example.yaml` for a complete example configuration using Gerrit instead of GitHub.
83
84## Structured Logging
85
86All Gerrit operations include structured logging:
87
88```
89INFO Creating Gerrit change url=https://gerrit.example.com/a/changes/ project=my-project subject="Task ABC-123: Implement feature" branch=main topic=task/ABC-123-implement-feature
90```
91
92## Comparison with GitHub
93
94| Feature | GitHub | Gerrit |
95|---------|--------|--------|
96| Changes/PRs | Pull Requests | Changes |
97| Review System | GitHub Reviews | Gerrit Code Review |
98| Merge | Merge PR | Submit Change |
99| Close | Close PR | Abandon Change |
100| URL Format | `/pull/123` | `/c/project/+/123` |
101| Authentication | Token | Username + Password/Token |
102
103## Migration
104
105To migrate from GitHub to Gerrit:
106
1071. Update configuration file or environment variables
1082. Remove GitHub configuration
1093. Restart the Staff system
1104. All new agent operations will use Gerrit
111
112Existing GitHub pull requests are not affected and remain accessible.
113
114## Troubleshooting
115
116### Common Issues
117
1181. **Authentication Failed**
119 - Verify username and password/token
120 - Check Gerrit HTTP credentials settings
121 - Ensure HTTP authentication is enabled
122
1232. **Project Not Found**
124 - Verify project name matches exactly
125 - Check user has access to the project
126 - Ensure project exists in Gerrit
127
1283. **Network Issues**
129 - Verify base URL is correct and accessible
130 - Check firewall/proxy settings
131 - Test connectivity to Gerrit server
132
133### Debug Logging
134
135Enable debug logging to troubleshoot issues:
136
137```yaml
138# Add to your configuration
139logging:
140 level: debug
141```
142
143This will show detailed HTTP requests and responses for Gerrit operations.