Push WebHook is triggered when creating release #10422

Closed
opened 2025-11-02 09:07:00 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @cclecle on GitHub (Mar 13, 2023).

Description

Hi,

I have a repository with 2 branches: master and dev.
I am building a CI/CD pipeline in Jenkins for that repository, with 1 task for each branch (so 2 tasks).
My Jenkins tasks are triggered by gitea Webhook.
Gitea Webooks are configured to only forward push events, and have an adequate filter ("master" and "dev).

Initial webHook and filter are working good, only the correct one is triggered, checked in logs too:

Mar 13 00:58:39 gitea gitea[453818]: 2023/03/13 00:58:39 ...s/webhook/webhook.go:184:PrepareWebhook() [I] Branch "master" doesn't match branch filter "dev", skipping

In Jenkins the correct task starts.

But the problem is:
At the end of my pipeline, I am using Gitea API to creaate a Release.
And this API operation is triggering again the webhook !
And worst, both of them... which create two build loop in jenkins.

I think it is not normal that release publishment is triggering the push webhook, does it ?
Would make more sense if release webhook were a custom one.

Then I tried to create a release using GUI and same behavior.
Good new, its easier to reproduce !

Gitea Version

1.19.0-rc1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.20.1

Operating System

debian buster

How are you running Gitea?

  • Using official gitea releases from github.
  • Gitea is running on the bare system using systemd script (no docker)
  • BUT the machine is a proxmox container (= lxc)

Database

None

Originally created by @cclecle on GitHub (Mar 13, 2023). ### Description Hi, I have a repository with 2 branches: master and dev. I am building a CI/CD pipeline in Jenkins for that repository, with 1 task for each branch (so 2 tasks). My Jenkins tasks are triggered by gitea Webhook. Gitea Webooks are configured to only forward push events, and have an adequate filter ("master" and "dev). Initial webHook and filter are working good, only the correct one is triggered, checked in logs too: ``` Mar 13 00:58:39 gitea gitea[453818]: 2023/03/13 00:58:39 ...s/webhook/webhook.go:184:PrepareWebhook() [I] Branch "master" doesn't match branch filter "dev", skipping ``` In Jenkins the correct task starts. But the problem is: At the end of my pipeline, I am using Gitea API to creaate a Release. And this API operation is triggering again the webhook ! And worst, both of them... which create two build loop in jenkins. I think it is not normal that release publishment is triggering the push webhook, does it ? Would make more sense if release webhook were a custom one. Then I tried to create a release using GUI and same behavior. Good new, its easier to reproduce ! ### Gitea Version 1.19.0-rc1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.20.1 ### Operating System debian buster ### How are you running Gitea? - Using official gitea releases from github. - Gitea is running on the bare system using systemd script (no docker) - BUT the machine is a proxmox container (= lxc) ### Database None
GiteaMirror added the type/bug label 2025-11-02 09:07:00 -06:00
Author
Owner

@lunny commented on GitHub (Mar 13, 2023):

Creating a release will also create a tag, you can differ the event type whether it's a tag or branch.

@lunny commented on GitHub (Mar 13, 2023): Creating a release will also create a tag, you can differ the event type whether it's a tag or branch.
Author
Owner

@cclecle commented on GitHub (Mar 13, 2023):

You are talking about the fact than when creating a release, if Draft is false, gitea creates a tag ?

So...you mean I need to check ref parameter in the Event json data, to check if it is refs/tags/* ?

@cclecle commented on GitHub (Mar 13, 2023): You are talking about the fact than when creating a release, if Draft is false, gitea creates a tag ? So...you mean I need to check ref parameter in the Event json data, to check if it is refs/tags/* ?
Author
Owner

@cclecle commented on GitHub (Mar 13, 2023):

Thank you @lunny !
I confirm it is working well with filtering events at Jenkins side.

Jenkins plugin configuration (Generic Webhook Trigger):
image
image

@cclecle commented on GitHub (Mar 13, 2023): Thank you @lunny ! I confirm it is working well with filtering events at Jenkins side. Jenkins plugin configuration (Generic Webhook Trigger): ![image](https://user-images.githubusercontent.com/15073640/224822589-9b21d766-d1ec-4217-a6cd-0d3b3fbd27ac.png) ![image](https://user-images.githubusercontent.com/15073640/224822662-69c171c2-cd7a-4953-bbf3-b585303cb222.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10422