Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhooks not working #4956

Closed
2 of 7 tasks
angapov opened this issue Dec 22, 2017 · 16 comments
Closed
2 of 7 tasks

Webhooks not working #4956

angapov opened this issue Dec 22, 2017 · 16 comments

Comments

@angapov
Copy link

angapov commented Dec 22, 2017

  • 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?
...

@Fastidious
Copy link
Contributor

Maybe related to #2598? Search open and closed issues for jenkins.

@angapov
Copy link
Author

angapov commented Dec 22, 2017

But "Test Delivery" is working, triggering new builds. That means that POST requests are nicely working with my Jenkins.

@jonaslimads
Copy link

This may be related to the variable LOCAL_ROOT_URL in custom/conf/app.ini. Also check if SSH related variables in that file are set.

@unknwon
Copy link
Member

unknwon commented Apr 3, 2018

Hi, please read and check your setup with https://discuss.gogs.io/t/how-to-config-ssh-settings/34.

@unknwon unknwon closed this as completed Apr 3, 2018
@bmustiata
Copy link

This has nothing to do with SSH.

Reproduction steps:

  1. Create a multibranch pipeline project in jenkins, that checks out the git project via http://
  2. Create a webhook in gogs that triggers the rescanning in jenkins. Tested it with the Test Delivery button manually, works fine (ie of working webhook: http://172.17.0.1:18080/git/notifyCommit?url=http://172.17.0.1:10080/raptor/multibranch.git ).
  3. Tried new pushes. Each time the webhook fails. In gogs the request is displayed as N/A, same as the response. The time is shown as "1970-01-01 00:00:00 UTC".

image

If triggered manually, then refreshed, the previous broken pushes magically appear as successful:

image

@unknwon
Copy link
Member

unknwon commented Apr 3, 2018

@bmustiata check errors in path/to/gogs/log/hooks, I think you'll find out why push didn't trigger webhook at most of time.

@bmustiata
Copy link

My bad, I was using a very old version (0.11.19). Works fine now (0.11.43). I am using the docker pushed containers.

@hhningkid
Copy link

I have the same problem, the environment is docker, manual success, git trigger failure

@blade5502
Copy link

Same problem here with latest official docker image. Works only 1/10 times as it should. The webhook is shown as failed with 1.1.1970 as date. After waiting 10-20s and a page refresh the date shows up correctly on the failed webhook - when i then press the resend button it works

@Victor2Code
Copy link

Same problem here. I am using the latest docker gogs/gogs image(version: 0.11.88.0220). "Redelivery" and "Test Deliver" will succeed, but can not auto deliver.

When the auto delivery fails, "Request" section shows "N/A", and the time will be 1970-01-01

@sorenbronsted
Copy link

I have the same problem (version: 0.11.34) as hhningkid, blade5502 and Vistor2Code

@unknwon
Copy link
Member

unknwon commented Feb 24, 2020

@sorenbronsted check errors in path/to/gogs/log/hooks, there should be something.

@sorenbronsted
Copy link

Nope it is empty :-(

@unknwon
Copy link
Member

unknwon commented Feb 24, 2020

Have you tried to enable trace level logging via [log] LEVEL = trace config option, then try to push again. If it's still empty, then there is a problem with your Gogs setup...

@sorenbronsted
Copy link

Thanks. I got it to work because I had some experiment with buildbot in custom_hook.

@EyeOfMidas
Copy link

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 my LOCAL_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 line

LOCAL_ROOT_URL = https://git.example.com/

adding the / fixed it, and now my webooks are firing correctly.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants