push webhook doesn't fire when pull request is merged #9545

Closed
opened 2025-11-02 08:42:30 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @berwyn on GitHub (Sep 9, 2022).

Description

I have a sever with Drone and Gitea setup where I want to run steps every time a PR is merged. Drone ignores the PR closed/merged action, so I thought to filter by pushes to main, however Gitea doesn't dispatch a push event when I merge my PRs (configured as rebase then fast-forward).

Since I cannot find any documentation that lays out what events are pushed and when, I have to assume it's a bug that no push webhook is fired when new commits are pushed to a ref using a PR.

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

gitea/gitea:1.17-rootless with docker-compose, docker-ce 20.10.18 running on Ubuntu 22.04

Database

PostgreSQL

Originally created by @berwyn on GitHub (Sep 9, 2022). ### Description I have a sever with Drone and Gitea setup where I want to run steps every time a PR is merged. Drone ignores the PR closed/merged action, so I thought to filter by pushes to `main`, however Gitea doesn't dispatch a `push` event when I merge my PRs (configured as rebase then fast-forward). Since I cannot find any documentation that lays out what events are pushed and when, I have to assume it's a bug that no push webhook is fired when new commits are pushed to a ref using a PR. ### Gitea Version 1.17.2 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? `gitea/gitea:1.17-rootless` with docker-compose, `docker-ce 20.10.18` running on Ubuntu 22.04 ### Database PostgreSQL
GiteaMirror added the issue/needs-feedback label 2025-11-02 08:42:30 -06:00
Author
Owner

@jerry3k commented on GitHub (Sep 10, 2022):

I can confim we have the same issue after we upgraded our Gitea from 1.16 to 1.17. Here are the version with the issue:
Drone Server: drone/drone:2.9.1
Gitea: 1.17.0
Manually 'Test Delivery' from Gitea does fire the webhook but not from 'push'.

Also Tested: I can confirm the issue was not there for 1.16.9.
Can folks please check which of these New Features/Setting change needs to be configured to get this working: https://blog.gitea.io/2022/07/gitea-1.17.0-is-released/#:~:text=Gitea%201.17%20lays%20the%20foundation,avatar%20can%20now%20be%20communicated.

My hunch is its this change: https://blog.gitea.io/2022/07/gitea-1.17.0-is-released/#-change-initial-trust-model-to-committer-18335httpsgithubcomgo-giteagiteapull18335 (Change initial trust model to committer ) Can someone test please.

@jerry3k commented on GitHub (Sep 10, 2022): I can confim we have the same issue after we upgraded our Gitea from 1.16 to 1.17. Here are the version with the issue: Drone Server: drone/drone:2.9.1 Gitea: 1.17.0 Manually 'Test Delivery' from Gitea does fire the webhook but not from 'push'. Also Tested: I can confirm the issue was not there for 1.16.9. Can folks please check which of these New Features/Setting change needs to be configured to get this working: [https://blog.gitea.io/2022/07/gitea-1.17.0-is-released/#:~:text=Gitea%201.17%20lays%20the%20foundation,avatar%20can%20now%20be%20communicated.](url) My hunch is its this change: [https://blog.gitea.io/2022/07/gitea-1.17.0-is-released/#-change-initial-trust-model-to-committer-18335httpsgithubcomgo-giteagiteapull18335](url) (Change initial trust model to committer ) Can someone test please.
Author
Owner

@exu-g commented on GitHub (Sep 11, 2022):

Push events never fire for me either. I tested creating commits directory to a monitored branch and merging a pull request.
Gitea 1.17.2
Woodpecker 0.15.4

In the Monitoring tab, the GET /user/events seems stuck

image

@exu-g commented on GitHub (Sep 11, 2022): Push events never fire for me either. I tested creating commits directory to a monitored branch and merging a pull request. Gitea 1.17.2 Woodpecker 0.15.4 In the Monitoring tab, the GET /user/events seems stuck <details> ![image](https://user-images.githubusercontent.com/61015582/189543636-3979ad73-0436-4c5d-a760-37274911e9a4.png) <details>
Author
Owner

@exu-g commented on GitHub (Sep 12, 2022):

Creating a tag doesn't fire events (Create in webhook) either, with /user/events being stuck.

@exu-g commented on GitHub (Sep 12, 2022): Creating a tag doesn't fire events (Create in webhook) either, with /user/events being stuck.
Author
Owner

@xtulnx commented on GitHub (Sep 16, 2022):

@jerry3k @RealStickman Did you fix it please?

@xtulnx commented on GitHub (Sep 16, 2022): @jerry3k @RealStickman Did you fix it please?
Author
Owner

@jerry3k commented on GitHub (Sep 16, 2022):

@xtulnx no fix available as of yet.

@jerry3k commented on GitHub (Sep 16, 2022): > @xtulnx no fix available as of yet.
Author
Owner

@lunny commented on GitHub (Sep 19, 2022):

webhook is unrelated with /user/events which is just related with notification UI. Could you find the webhook record in history?

@lunny commented on GitHub (Sep 19, 2022): `webhook` is unrelated with `/user/events` which is just related with notification UI. Could you find the webhook record in history?
Author
Owner

@xtulnx commented on GitHub (Sep 20, 2022):

@jerry3k @RealStickman hi, I temporarily solved the problem of service exception by downgrading.

  1. Stop the service. Back up your data if necessary

  2. Git Image tag use 1.16.9: "gitea/gitea:1.16.9"

  3. Delete the record with type=9 in the repo_unit table (Database):

    delete from repo_unit where `type`=9;
    
  4. Modify version=211 in the version table:

    update version set version=211 where version>211
    

Downgraded 1.17.2 and 1.18.0-dev successfully.

Now my webhook and the latest activity in the homepage are back to normal

@xtulnx commented on GitHub (Sep 20, 2022): @jerry3k @RealStickman hi, I temporarily solved the problem of service exception by downgrading. 1. Stop the service. **Back up your data if necessary** 1. Git Image tag use 1.16.9: `"gitea/gitea:1.16.9"` 1. Delete the record with type=9 in the `repo_unit` table (Database): ```sql delete from repo_unit where `type`=9; ``` 3. Modify version=211 in the version table: ```sql update version set version=211 where version>211 ``` Downgraded 1.17.2 and 1.18.0-dev successfully. Now my webhook and the latest activity in the homepage are back to normal
Author
Owner

@jerry3k commented on GitHub (Sep 21, 2022):

@jerry3k @RealStickman hi, I temporarily solved the problem of service exception by downgrading.

  1. Stop the service. Back up your data if necessary
  2. Git Image tag use 1.16.9: "gitea/gitea:1.16.9"
  3. ...
  4. Modify version=211 ...
    Downgraded 1.17.2 and 1.18.0-dev successfully.

Now my webhook and the latest activity in the homepage are back to normal

Please do NOT do this, as you will be UNABLE to upgrade it in future!

@jerry3k commented on GitHub (Sep 21, 2022): > @jerry3k @RealStickman hi, I temporarily solved the problem of service exception by downgrading. > > 1. Stop the service. **Back up your data if necessary** > 2. Git Image tag use 1.16.9: `"gitea/gitea:1.16.9"` > 3. ... > 4. Modify version=211 ... > Downgraded 1.17.2 and 1.18.0-dev successfully. > > Now my webhook and the latest activity in the homepage are back to normal Please do NOT do this, as you will be UNABLE to upgrade it in future!
Author
Owner

@wxiaoguang commented on GitHub (Sep 28, 2022):

I just setup a Gitea 1.17.2 (docker/docker-rootless) locally and did a full test, all work as expected.

If there is a problem, there are only a few possibilities:

  1. The docker server (not client!) version is too low: make sure >=20.10.6
  2. The git hooks are out of sync: "Resynchronize pre-receive, update and post-receive hooks of all repositories" on the site admin panel
  3. The git repositories (and hooks) are stored on some filesystems(Windows/NAS) which don't support script execution, which is pretty a rare case.

(off topic: /user/events is designed to block for long time for long-polling, it's not related. And DO NOT downgrade by changing the version value in database manually if you are not an experienced Gitea developer)

If you think you encounter a bug, it needs more information to debug. It would be very helpful to provide a reproducible setup (docker-compose config and steps)


The details about push event and webhook:

client git push -> ssh server -> gitea serv sub-command -> git operation -> git hook runs scripts in the repository on the server -> gitea hook sub-command calls the internal HTTP api -> gitea web gets the push event -> insert into database (show activity on the dashboard) -> trigger webhook.

gitea online editor -> git operation -> git hook -> (the same as above).


Test Result

Docker (root)

image

Docker (rootless, merge PR with rebase)

image

@wxiaoguang commented on GitHub (Sep 28, 2022): I just setup a Gitea 1.17.2 (docker/docker-rootless) locally and did a full test, all work as expected. If there is a problem, there are only a few possibilities: 1. The docker server (not client!) version is too low: make sure >=20.10.6 2. The git hooks are out of sync: "Resynchronize pre-receive, update and post-receive hooks of all repositories" on the site admin panel 3. The git repositories (and hooks) are stored on some filesystems(Windows/NAS) which don't support script execution, which is pretty a rare case. (off topic: `/user/events` is designed to block for long time for long-polling, it's not related. And DO NOT downgrade by changing the version value in database manually if you are not an experienced Gitea developer) If you think you encounter a bug, it needs more information to debug. It would be very helpful to provide a reproducible setup (docker-compose config and steps) ---- The details about `push` event and webhook: client git push -> ssh server -> gitea serv sub-command -> git operation -> **git hook** runs scripts in the repository on the server -> **gitea hook** sub-command calls the internal HTTP api -> gitea web gets the push event -> insert into database (show activity on the dashboard) -> trigger webhook. gitea online editor -> git operation -> **git hook** -> (the same as above). ---- Test Result Docker (root) <details> ![image](https://user-images.githubusercontent.com/2114189/192773583-1e314f3f-9805-446b-ba94-e3a7aca51fac.png) </details> Docker (rootless, merge PR with rebase) <details> ![image](https://user-images.githubusercontent.com/2114189/192775822-5a55ab4f-d178-4f34-af2c-49c9be01a9a9.png) </details>
Author
Owner

@exu-g commented on GitHub (Sep 28, 2022):

@wxiaoguang Thanks for the detailed reply.
I can confirm storing stuff on a samba share was the issue for me. Local storage works.
Guess I'll have to use that going forward for gitea.

@exu-g commented on GitHub (Sep 28, 2022): @wxiaoguang Thanks for the detailed reply. I can confirm storing stuff on a samba share was the issue for me. Local storage works. Guess I'll have to use that going forward for gitea.
Author
Owner

@kSandr-ki commented on GitHub (Apr 17, 2023):

I still don't understand
how docker version affects this, is it possible to somehow fix this without touching docker? I really dont wanna touch docker on production server ....

@kSandr-ki commented on GitHub (Apr 17, 2023): I still don't understand how docker version affects this, is it possible to somehow fix this without touching docker? I really dont wanna touch docker on production server ....
Author
Owner
@wxiaoguang commented on GitHub (Apr 17, 2023): Because it's a Docker's bug: * https://github.com/go-gitea/gitea/issues/20103#issuecomment-1166268520 * https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0
Author
Owner

@kSandr-ki commented on GitHub (Apr 18, 2023):

thanks

@kSandr-ki commented on GitHub (Apr 18, 2023): thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9545