This is an application that helps to modify Gitea
webhook request before it reaches a GitOps system (e.g.
ArgoCD or FluxCD).
It replaces certain string pattern specified by a regular expression
with another string anywhere in the JSON payload. By default, this is
used to replace the ingress URL (e.g. http://git.localhost/
) with
in-cluster service URL (e.g. http://gitea-http.gitea:3000/
).
Run the server:
GWM_LOG_LEVEL=trace GWM_FORWARD='http://localhost:8080' go run ./cmd/gwm/main.go
Send data:
curl -v -d '{"url":"http://git.localhost/myorg/tenant1"}' localhost:8080/webhook
Install the GWM onto the cluster:
helm install -n gwm gwm oci://ghcr.io/jtyr/helm/gwm
Go to your local Gitea Web UI and define a GOGS webhook
to be sent to http://gwm.gwm/webhook
.
There is several environment variables that can change the default behavior of the application:
GWM_HOST
- Host name on which the HTTP server runs. Defaults to0.0.0.0
.GWM_PORT
- Port number on which the HTTP server runs. Defaults to8080
.GWM_SEARCH
- Regexp to search for a specific string to be replaced. Defaults to^http://git.localhost/
.GWM_REPLACE
- Regexp used to replace the found string. Defaults tohttp://gitea-http.gitea:3000/
.GWM_FORWARD
- URL to which to forward the modified request. Defaults tohttp://argocd-server.argocd/api/webhook
.GWM_LOG_LEVEL
- Log level. Possible values arepanic
,fatal
,error
,warn
,info
,debug
andtrace
. Defaults toinfo
.
MIT
Jiri Tyr