122 lines
2.9 KiB
Markdown
122 lines
2.9 KiB
Markdown
# Claw Code Gitea Identity Setup
|
|
|
|
## Blocker
|
|
This VM (167.99.126.228) cannot reach Gitea at 100.101.194.61 (Tailscale network).
|
|
Tailscale status: Logged out.
|
|
|
|
## Solution
|
|
Run these steps on a machine with Tailscale access (Ezra or your local machine).
|
|
|
|
---
|
|
|
|
## Step 1: Create Claw-Code User
|
|
|
|
SSH to Gitea host or use Ezra:
|
|
|
|
```bash
|
|
# SSH to Ezra first, then:
|
|
ssh 100.101.194.61
|
|
|
|
# Or run from any Tailscale-connected machine:
|
|
export GITEA_URL="http://100.101.194.61:3000"
|
|
export ADMIN_TOKEN="your-admin-token"
|
|
|
|
# Create claw-code user
|
|
curl -X POST "${GITEA_URL}/api/v1/admin/users" \
|
|
-H "Authorization: token ${ADMIN_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"username": "claw-code",
|
|
"email": "claw-code@timmy.local",
|
|
"password": "TEMP-PASS-CHANGE-ME",
|
|
"full_name": "Claw Code Harness",
|
|
"must_change_password": false
|
|
}'
|
|
```
|
|
|
|
## Step 2: Generate API Token
|
|
|
|
```bash
|
|
# Create token for claw-code
|
|
curl -X POST "${GITEA_URL}/api/v1/users/claw-code/tokens" \
|
|
-H "Authorization: token ${ADMIN_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "harness-automation",
|
|
"scopes": ["repo", "issue", "pull_request", "webhook"]
|
|
}'
|
|
```
|
|
|
|
Save the token response - you'll need the `sha1` value.
|
|
|
|
## Step 3: Add to Organization
|
|
|
|
```bash
|
|
# Add claw-code to timmy-time org with write access
|
|
curl -X PUT "${GITEA_URL}/api/v1/orgs/timmy-time/members/claw-code" \
|
|
-H "Authorization: token ${ADMIN_TOKEN}" \
|
|
-d '{"role": "write"}'
|
|
```
|
|
|
|
## Step 4: Configure Webhook
|
|
|
|
```bash
|
|
# Create webhook for auto-dispatch
|
|
curl -X POST "${GITEA_URL}/api/v1/repos/timmy-time/timmy/hooks" \
|
|
-H "Authorization: token ${ADMIN_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"type": "gitea",
|
|
"config": {
|
|
"url": "http://167.99.126.228:8646/webhook/gitea",
|
|
"content_type": "json",
|
|
"secret": "your-webhook-secret"
|
|
},
|
|
"events": ["issues", "issue_comment", "pull_request", "label"],
|
|
"active": true
|
|
}'
|
|
```
|
|
|
|
## Step 5: Update Allegro VM
|
|
|
|
Add to `/root/wizards/allegro/home/.env`:
|
|
|
|
```bash
|
|
CLAW_CODE_GITEA_TOKEN=the-token-from-step-2
|
|
CLAW_CODE_WEBHOOK_SECRET=the-secret-from-step-4
|
|
```
|
|
|
|
Then restart Allegro or reload config.
|
|
|
|
## Step 6: Test Claw Code Dispatch
|
|
|
|
```bash
|
|
# On Allegro VM (167.99.126.228)
|
|
ssh 167.99.126.228
|
|
cd /root/wizards/allegro
|
|
source home/.env
|
|
|
|
# Run test dispatch - creates PR as claw-code
|
|
python3 claw-code-dispatcher.py test
|
|
```
|
|
|
|
## Expected Result
|
|
|
|
PR created by `claw-code` user (not allegro, not timmy):
|
|
- Author: claw-code
|
|
- Avatar: Default Gitea avatar
|
|
- Commits: Signed by claw-code
|
|
- Comments: Posted by claw-code
|
|
|
|
## Files Prepared
|
|
|
|
| File | Purpose | Location |
|
|
|------|---------|----------|
|
|
| `claw-code-gitea-setup.sh` | User/token/webhook creation | `/root/wizards/allegro/` |
|
|
| `claw-code-dispatcher.py` | Auto-dispatch logic | `/root/wizards/allegro/` |
|
|
| `CLAW-CODE-SETUP-GUIDE.md` | This guide | `/root/wizards/allegro/` |
|
|
|
|
---
|
|
|
|
**Ready for execution once Tailscale connectivity restored.**
|