How nibinrj/buildlens works
BuildLens collects Jenkins build metadata, stage timings, test reports and log tails; its CLI streams them to an HTTP service, which validates and parses reports before transactional ingestion into PostgreSQL. The service also exposes build and health endpoints. Quarantine retrieval is advertised by the CLI but remains an unimplemented stub. The sampled source supports the main server and ingest connections; Jenkins shared-library internals and some runtime wiring are represented only where the CLI explicitly refers to them.
Main entry points: main.go HTTP server · builds.go Build API · report.go Report upload · ingest.go Ingest service
Components 17
Jenkins capture
- Stage timing
shared-library/vars/timedStage.groovy - Build reporting
shared-library/vars/reportBuild.groovy
Upload client
- BuildLens CLI
cmd/buildlens/main.go - Report upload
cmd/buildlens/report.go - Upload format
internal/upload/upload.go - Quarantine command
cmd/buildlens/main.go
Ingest service
- HTTP server
cmd/buildlens-server/main.go - Build API
internal/api/builds.go - Health endpoint
internal/api/health.go - Surefire parser
internal/surefire/surefire.go - Ingest service
internal/ingest/ingest.go - Configuration
internal/config/config.go
Persistence
- Database setup
internal/db/db.go - Schema migrations
migrations/embed.go - SQL store
internal/store/ingest.sql.go - PostgreSQL
Other components
- Jenkins pipeline
Connections 18
- Jenkins pipeline → BuildLens CLI: runs
cmd/buildlens/main.go - Stage timing → Build reporting: records stages
- Build reporting → Report upload: provides timings
cmd/buildlens/report.go - BuildLens CLI → Report upload: dispatches report
cmd/buildlens/main.go - Report upload → Upload format: encodes upload
cmd/buildlens/report.go - Report upload → HTTP server: posts build
- HTTP server → Configuration: loads settings
cmd/buildlens-server/main.go - HTTP server → Database setup: opens database
cmd/buildlens-server/main.go - HTTP server → Build API: registers routes
- HTTP server → Health endpoint: serves health
- Build API → Upload format: validates parts
internal/api/builds.go - Build API → Surefire parser: parses reports
internal/api/builds.go - Build API → Ingest service: submits build
internal/api/builds.go - Ingest service → Surefire parser: merges results
internal/ingest/ingest.go - Ingest service → SQL store: runs queries
internal/ingest/ingest.go - SQL store → PostgreSQL: executes SQL
internal/store/ingest.sql.go - Database setup → PostgreSQL: connects
internal/db/db.go - Database setup → Schema migrations: applies schema
internal/db/db.go