Skip to content

Commit b4d007d

Browse files
committed
fix: Address PR review comments
- Remove troubleshooting section from Gerrit documentation per review feedback - Replace delete operator with undefined assignment for better performance in tests
1 parent c6fcdb6 commit b4d007d

File tree

2 files changed

+8
-123
lines changed

2 files changed

+8
-123
lines changed

docs/docs/connections/gerrit.mdx

Lines changed: 6 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ Sourcebot can sync code from self-hosted Gerrit instances, including both public
1616

1717
### Authentication Methods
1818

19-
Gerrit supports multiple authentication methods with Sourcebot:
19+
Gerrit supports these authentication methods with Sourcebot:
2020

2121
1. **Public Access**: For publicly accessible projects (no authentication required)
2222
2. **HTTP Basic Auth**: Using Gerrit username and HTTP password
23-
3. **Cookie-based Auth**: Using Gerrit session cookies (advanced)
2423

2524
## Connecting to a Gerrit instance
2625

@@ -70,62 +69,18 @@ When running with Docker:
7069
docker run -e GERRIT_HTTP_PASSWORD="your-http-password" ...
7170
```
7271

73-
## Authentication Setup Guide
72+
## Authentication Setup
7473

75-
### Step 1: Generate HTTP Password in Gerrit
74+
### Generate HTTP Password
7675

7776
1. Log into your Gerrit instance
78-
2. Go to **Settings** (top-right menu)
79-
3. Navigate to **HTTP Credentials**
80-
4. Click **Generate Password**
81-
5. Copy the generated password (this is your HTTP password)
82-
83-
### Step 2: Test API Access
84-
85-
Verify your credentials work with Gerrit's API:
86-
87-
```bash
88-
curl -u "username:http-password" \
89-
"https://gerrit.example.com/a/projects/?d"
90-
```
91-
92-
Expected response: JSON list of projects you have access to.
93-
94-
### Step 3: Test Git Clone Access
95-
96-
Verify git clone works with your credentials:
97-
98-
```bash
99-
git clone https://[email protected]/a/project-name
100-
# When prompted, enter your HTTP password
101-
```
77+
2. Go to **Settings****HTTP Credentials****Generate Password**
78+
3. Copy the generated password (this is your HTTP password)
10279

10380
<Note>
104-
**Special Characters in Passwords**: If your HTTP password contains special characters like `/`, `+`, or `=`, Sourcebot automatically handles URL encoding for git operations. No manual encoding is required on your part.
81+
**Special Characters**: If your HTTP password contains special characters like `/`, `+`, or `=`, Sourcebot automatically handles URL encoding for git operations.
10582
</Note>
10683

107-
### Step 4: Configure Sourcebot
108-
109-
Add the authenticated connection to your `config.json`:
110-
111-
```json
112-
{
113-
"connections": {
114-
"my-gerrit": {
115-
"type": "gerrit",
116-
"url": "https://gerrit.example.com",
117-
"projects": ["project-name"],
118-
"auth": {
119-
"username": "your-username",
120-
"password": {
121-
"env": "GERRIT_HTTP_PASSWORD"
122-
}
123-
}
124-
}
125-
}
126-
}
127-
```
128-
12984
## Examples
13085

13186
<AccordionGroup>
@@ -202,76 +157,6 @@ Add the authenticated connection to your `config.json`:
202157
</Accordion>
203158
</AccordionGroup>
204159

205-
## Troubleshooting
206-
207-
### Common Issues
208-
209-
<AccordionGroup>
210-
<Accordion title="Authentication Failed / 401 Unauthorized">
211-
**Symptoms**: Sourcebot logs show authentication errors or 401 status codes.
212-
213-
**Solutions**:
214-
1. Verify you're using the **HTTP password**, not your account password
215-
2. Test credentials manually:
216-
```bash
217-
curl -u "username:password" "https://gerrit.example.com/a/projects/"
218-
```
219-
3. Check if your Gerrit username is correct
220-
4. Regenerate HTTP password in Gerrit settings
221-
5. Ensure the environment variable is properly set
222-
</Accordion>
223-
224-
<Accordion title="No Projects Found / 0 Repos Synced">
225-
**Symptoms**: Sourcebot connects but finds 0 repositories to sync.
226-
227-
**Solutions**:
228-
1. Verify project names exist and are accessible
229-
2. Check project permissions in Gerrit
230-
3. Test project access manually:
231-
```bash
232-
curl -u "username:password" \
233-
"https://gerrit.example.com/a/projects/project-name"
234-
```
235-
4. Use glob patterns if unsure of exact project names:
236-
```json
237-
"projects": ["*"] // Sync all accessible projects
238-
```
239-
</Accordion>
240-
241-
<Accordion title="Git Clone Failures">
242-
**Symptoms**: Git clone operations fail during repository sync.
243-
244-
**Solutions**:
245-
1. Verify git clone works manually:
246-
```bash
247-
git clone https://[email protected]/a/project-name
248-
```
249-
2. Check network connectivity and firewall rules
250-
3. Ensure Gerrit server supports HTTPS
251-
4. Verify the `/a/` prefix is included in clone URLs
252-
</Accordion>
253-
254-
<Accordion title="Schema Validation Errors">
255-
**Symptoms**: Config validation errors about additional properties.
256-
257-
**Solutions**:
258-
1. Ensure your configuration matches the schema exactly
259-
2. Check that all required fields are present
260-
3. Verify the `auth` object structure:
261-
```json
262-
"auth": {
263-
"username": "string",
264-
"password": {
265-
"env": "ENVIRONMENT_VARIABLE"
266-
}
267-
}
268-
```
269-
</Accordion>
270-
</AccordionGroup>
271-
272-
273-
274-
275160
## Schema Reference
276161

277162
<Accordion title="Reference">

packages/crypto/src/tokenUtils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe('tokenUtils', () => {
1919
};
2020

2121
vi.clearAllMocks();
22-
delete process.env.TEST_TOKEN;
23-
delete process.env.EMPTY_TOKEN;
22+
process.env.TEST_TOKEN = undefined;
23+
process.env.EMPTY_TOKEN = undefined;
2424
});
2525

2626
describe('getTokenFromConfig', () => {

0 commit comments

Comments
 (0)