Skip to content

Commit 02cafd8

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 8cee5d4 commit 02cafd8

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
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
2625

@@ -72,62 +71,18 @@ When running with Docker:
7271
docker run -e GERRIT_HTTP_PASSWORD="your-http-password" ...
7372
```
7473

75-
## Authentication Setup Guide
74+
## Authentication Setup
7675

77-
### Step 1: Generate HTTP Password in Gerrit
76+
### Generate HTTP Password
7877

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

10582
<Note>
106-
**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.
83+
**Special Characters**: If your HTTP password contains special characters like `/`, `+`, or `=`, Sourcebot automatically handles URL encoding for git operations.
10784
</Note>
10885

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

13388
<AccordionGroup>
@@ -204,76 +159,6 @@ Add the authenticated connection to your `config.json`:
204159
</Accordion>
205160
</AccordionGroup>
206161

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

279164
<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)