一个代理,可让 webhooks 到达防火墙后运行的服务 – [✩ 星标] 如果您在使用它!
A proxy to let webhooks to reach a Jenkins instance running behind a firewall
Jenkins is awesome and matchless tool for both CI & CD; but unfortunately its a gold mine if left in wild with wide open access; so, we always want to put it behind a firewall. But when we put it behind firewall then webhooks don't work anymore and no one wants the pull based polling but rather prefer the build to start as soon as there is a commit!
This little proxy makes webhooks start working again!
Currently we support the following git providers out of the box:
GitWebhookProxy can be configured by providing the following arguments either via command line or via environment variables:
| Parameter | Description | Default | Example |
|---|---|---|---|
| listenAddress | Address on which the proxy listens. | :8080 |
127.0.0.1:80 |
| upstreamURL | URL to which the proxy requests will be forwarded (required) | https://someci-instance-url.com/webhook/ |
|
| secret | Secret of the Webhook API. If not set validation is not made. | iamasecret |
|
| provider | Git Provider which generates the Webhook | github |
github or gitlab |
| allowedPaths | Comma-Separated String List of allowed paths on the proxy | /project or github-webhook/,project/ |
|
| ignoredUsers | Comma-Separated String List of users to ignore while proxying Webhook request | someuser |
|
| allowedUsers | Comma-Separated String List of users to allow while proxying Webhook request | someuser |
The GitWebhookProxy can be deployed with vanilla manifests or Helm Charts.
For Vanilla manifests, you can either first clone the respository or download the deployments/kubernetes/gitwebhookproxy.yaml file only.
Below mentioned attributes in gitwebhookproxy.yaml have been hard coded to run in our cluster. Please make sure to update values of these according to your own configuration.
Ingress in gitwebhookproxy.yaml rules:
- host: gitwebhookproxy.example.com tls:
- hosts:
- gitwebhookproxy.example.comSecret in gitwebhookproxy.yamldata:
secret: exampleConfigMap in gitwebhookproxy.yamldata:
provider: github
upstreamURL: https://jenkins.example.com
allowedPaths: /github-webhook,/project
ignoredUsers: stakater-userThen you can deploy GitwebhookProxy by running the following kubectl commands:
kubectl apply -f gitwebhookproxy.yaml -n Note: Make sure to update the port in deployment.yaml as well as service.yaml if you change the default listenAddress port.
Alternatively if you have configured helm on your cluster, you can add gitwebhookproxy to helm from our public chart repository and deploy it via helm using below mentioned commands
Add the chart repo:
i. helm repo add stakater https://stakater.github.io/stakater-charts/
ii. helm repo update
Set configuration as discussed in the Configuring section
i. helm fetch --untar stakater/gitwebhookproxy
ii. Open and edit gitwebhookproxy/values.yaml in a text editor and update the values mentioned in Configuring section.
Install the chart
helm install stakater/gitwebhookproxy -f gitwebhookproxy/values.yaml -n gitwebhookproxyTo run the docker container outside of Kubernetes, you can pass the configuration as the Container Entrypoint arguments. The docker image is available on docker hub. Example below:
docker run stakater/gitwebhookproxy:v0.2.63 -listen :8080 -upstreamURL google.com -provider github -secret "test"
For docker compose, the syntax is a bit different
jenkinswebhookproxy:
image: 'stakater/gitwebhookproxy:latest'
command: ["-listen", ":8080", "-secret", "test", "-upstreamURL", "jenkins.example.com, "-allowedPaths", "/github-webhook,/ghprbhook"]
restart: on-failureIf you get the following error when setting up webhooks for your jobs in Jenkins, make sure you have the trailing / in the webhook configured in Jenkins.
Error Redirecting '/github-webhook' to upstream', Upstream Redirect Status: 405 Method Not AllowedGot a question? File a GitHub issue, or send us an email.
Join and talk to us on the #tools-gwp channel for discussing about GitWebhookProxy
Please use the issue tracker to report any bugs or file feature requests.
PRs are welcome. In general, we follow the "fork-and-pull" Git workflow.
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
View our closed Pull Requests.
Apache2 © Stakater
GitWebhookProxy is maintained by Stakater. Like it? Please let us know at
See our other projects or contact us in case of professional services and queries on
暂无开放 Issues,或尚未同步最近议题。