gogs: Webhooks not working
- Gogs version (or commit ref): 0.11.34.1122
- Git version: 2.11.3
- Operating system: Docker image on Ubuntu 16.04
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gogs.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist (usually found in
log/gogs.log
):
I have a Docker image of Gogs (gogs/gogs:latest) running. I configured webhook for Jenkins like this: “http://172.24.4.16/jenkins/gogs-webhook/?job=test” When I press “Test Delivery” - it is working nicely and new build is triggered in Jenkins. However when I git push via SSH - nothing happens.
When I press “Test Delivery” - I see the following in gogs.log:
2017/12/22 13:47:45 [TRACE] DeliverHooks [repo_id: 6]
[Macaron] 2017-12-22 13:47:45: Completed POST /gogs_admin/RF_build_automation/settings/hooks/1/test 200 OK in 292.116621ms
2017/12/22 13:47:45 [TRACE] Hook delivered: 30be5d41-1f7a-4d28-bef9-19f33dc9559b
But when pushing by SSH I do not see anything and no Jenkins build is started.
On https://try.gogs.io webhooks are working fine with me.
Can you help me? …
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (5 by maintainers)
Sorry for commenting on a closed issue, but I figured my personal issue out and I wanted to share:
I have gogs running behind an nginx proxy, using the
unix
protocol to connect. I had this issue for a long time, with nothing coming up in the logs even though it would fail when I did a commit, but succeed if I did it manually (or on a restart). I chanced on a solution when I committed to a project with an invalid git hook for post_receive; I inspected the/var/log/gogs/hooks/post_receive.log
and found the error:(I replaced my domain and IP with example ones)
2020/12/15 19:21:52 [ERROR] [...pu/opt/gogs/internal/cmd/hook.go:251 runHookPostReceive()] Failed to trigger task: Get "https://git.example.comEyeOfMidas/demo-project/tasks/trigger?branch=master&pusher=1&secret=SECRET": dial tcp: lookup git.example.comEyeOfMidas on 127.0.0.1:53: no such host
It turns out I was missing a
/
at the end of my definition of myLOCAL_ROOT_URL
so the url was getting mashed up with my username. In my/etc/gogs/conf/app.ini
I changed the value to this lineLOCAL_ROOT_URL = https://git.example.com/
adding the
/
fixed it, and now my webooks are firing correctly.Thanks. I got it to work because I had some experiment with buildbot in custom_hook.
But “Test Delivery” is working, triggering new builds. That means that POST requests are nicely working with my Jenkins.