A lightweight Go service that bridges Forgejo webhooks to the Mogenius Renovate Operator in Kubernetes.
https://opencommit.eu/opencommit/webhook-bridge
- Go 98.7%
- Dockerfile 1.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| internal/renovateapi | ||
| .dockerignore | ||
| .golangci.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| handler.go | ||
| handler_test.go | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
| renovate.json | ||
| repos.go | ||
| repos_test.go | ||
webhook-bridge
A lightweight Go service that bridges Forgejo webhooks to the Mogenius Renovate Operator in Kubernetes.
Instead of configuring per-repository webhooks in Forgejo, a single system-wide webhook points at this bridge. It filters events and forwards only those for repositories managed by Renovate.
How It Works
- Connects to the Kubernetes API and watches
RenovateJobcustom resources in therenovate-operatornamespace. - Maintains an in-memory cache of onboarded repositories (jobs with
spec.webhook.enabled: true). - Receives Forgejo webhook events at
/webhook, validates the bearer token, and checks whether the repository is onboarded. - Forwards matching events (with original headers and body) to the Renovate Operator's webhook endpoint.
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
WEBHOOK_TOKEN_SECRET |
Yes | — | Bearer token for authenticating incoming webhook requests |
LISTEN_ADDR |
No | :8080 |
Address and port for the HTTP server |
OPERATOR_WEBHOOK_URL |
No | http://renovate-operator.renovate-operator.svc.cluster.local:8080/webhook/v1/forgejo |
Renovate Operator webhook endpoint |
Endpoints
| Method | Path | Description |
|---|---|---|
POST |
/webhook |
Receives Forgejo webhook events |
GET |
/healthz |
Health check |
Building
go build -o webhook-bridge .
Docker
docker build -t webhook-bridge .
docker run -e WEBHOOK_TOKEN_SECRET=my-secret webhook-bridge
The Dockerfile produces a minimal distroless image running as non-root.
Prerequisites
- A Kubernetes cluster with the Mogenius Renovate Operator installed.
RenovateJobcustom resources withspec.webhook.enabled: truein therenovate-operatornamespace.- Forgejo configured with a system-wide webhook pointing at this service's
/webhookpath.
Running Tests
go test ./... -v
License
This project is licensed under the Mozilla Public License 2.0.