This guide shows you how to test the complete CI/CD analysis flow:
GitHub Webhook → Backend → BullMQ Queue → Worker → AI Analysis → Database
docker-compose up -dVerify:
redis-cli ping
# Should return: PONGnpm run start:backendShould see:
Log processing queue initialized.Server is running on http://localhost:3001✅ Google Gemini AI initialized (gemini-1.5-flash)
npm run start:workerShould see:
Log processing worker started.
Run the complete test script:
./test-webhook-flow.shThis script will:
- ✅ Check Redis is running
- ✅ Check backend server
- ✅ Check worker process
- ✅ Simulate GitHub webhook
- ✅ Verify job in queue
- ✅ Monitor worker processing
Create test-webhook.json:
{
"action": "completed",
"workflow_run": {
"id": 123456789,
"name": "CI Build",
"conclusion": "failure",
"html_url": "https://github.com/youruser/yourrepo/actions/runs/123456789"
},
"repository": {
"full_name": "youruser/yourrepo",
"name": "yourrepo"
},
"installation": {
"id": 12345
}
}# Your webhook secret from .env
SECRET="your_webhook_secret_here"
# Calculate signature
SIGNATURE=$(cat test-webhook.json | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')
echo "sha256=$SIGNATURE"curl -X POST http://localhost:3001/api/webhooks/github \
-H "Content-Type: application/json" \
-H "X-GitHub-Event: workflow_run" \
-H "X-Hub-Signature-256: sha256=$SIGNATURE" \
-d @test-webhook.jsonExpected Response:
Event received
# Check queue size
redis-cli llen "bull:log-processing:wait"
# View job details
redis-cli --raw lrange "bull:log-processing:wait" 0 -1 | jq '.'In your worker terminal, you should see:
Processing job for run ID: 123456789 in repo: youruser/yourrepo
Successfully fetched log URL for run 123456789
Downloading logs from: https://...
🤖 Sending request to Google Gemini AI...
✅ Received response from Gemini AI
Saving analysis results to database...
Analysis saved for run 123456789
npm run prisma:studioOpen http://localhost:5555 and check:
WorkflowRuntable - should have entry for run ID 123456789AnalysisResulttable - should have AI analysis
| Problem | Solution |
|---|---|
Redis connection refused |
Run docker-compose up -d |
No jobs in queue |
Check webhook signature is correct |
Worker not processing |
Ensure worker is running with npm run start:worker |
| Problem | Solution |
|---|---|
401 Invalid signature |
Check GITHUB_WEBHOOK_SECRET in .env matches |
404 Not Found |
Verify backend is running on port 3001 |
Job not queued |
Check backend logs for errors |
| Problem | Solution |
|---|---|
GitHub authentication failed |
Set GITHUB_APP_ID and GITHUB_PRIVATE_KEY in .env |
AI error |
Set GEMINI_API_KEY in .env |
WorkflowRun not found |
Worker expects run to exist in DB first |
To receive real webhooks from GitHub:
- Go to your repo → Settings → GitHub Apps
- Install your CI/CD Analyzer app
- Webhook URL:
https://your-domain.com/api/webhooks/github - Events: Select "Workflow runs"
- Secret: Set your
GITHUB_WEBHOOK_SECRET
# Install ngrok
npm install -g ngrok
# Expose local server
ngrok http 3001Use the ngrok URL in GitHub webhook settings:
https://abc123.ngrok.io/api/webhooks/github
# Jobs waiting
redis-cli llen "bull:log-processing:wait"
# Jobs completed
redis-cli llen "bull:log-processing:completed"
# Jobs failed
redis-cli llen "bull:log-processing:failed"# Clear all queues
redis-cli del "bull:log-processing:wait"
redis-cli del "bull:log-processing:completed"
redis-cli del "bull:log-processing:failed"You know everything is working when:
- ✅ Webhook returns
200 Event received - ✅ Backend logs show
Dispatched job for run ID: ... - ✅ Worker logs show
Processing job for run ID: ... - ✅ Worker logs show
🤖 Sending request to Google Gemini AI... - ✅ Worker logs show
✅ Received response from Gemini AI - ✅ Worker logs show
Analysis saved for run ... - ✅ Database has entry in
AnalysisResulttable
# Start everything
docker-compose up -d # Redis
npm run start:backend # Backend server
npm run start:worker # Worker process
# Test webhook flow
./test-webhook-flow.sh # Automated test
# Monitor
redis-cli monitor # Watch Redis commands
npm run prisma:studio # View databaseThat's it! Your webhook → queue → worker → AI flow is ready to test! 🎉