why webhooks do not work?

328 views
Skip to first unread message

Sun King

unread,
Mar 16, 2022, 2:38:57 AM3/16/22
to Repo and Gerrit Discussion
Hi,
I have created webhooks.config in meta/config branch.

[remote "git-lab"]
  url = https://my-webhooks.com
  maxTries = 3

I do not have a event value because I want everyevent posted.

And gerrit.config is 
[plugin "webhooks"]
  connectionTimeout = 3000
  socketTimeout = 2500
  maxTries = 300
  retryInterval = 2000
  threadPoolSize = 3

how to confirm a webhook is triggerd?
Is there any log info and where is it please.

Thank you.
BR.
sk.

Sun King

unread,
Mar 16, 2022, 3:17:03 AM3/16/22
to Repo and Gerrit Discussion
And yes,  I can get my webhooks via REST-API in [1] .

Matthias Sohn

unread,
Mar 16, 2022, 5:20:08 AM3/16/22
to Sun King, Repo and Gerrit Discussion
Try to set the log level of com.googlesource.gerrit.plugins.webhooks to DEBUG and check the error_log:
  • list log levels using the "gerrit logging ls-level" ssh command [1]
  • and set them using the "gerrit logging set-level" ssh command [2]
  • or use the log-level plugin to configure log levels permanently [3]


-Matthias 

Thank you.
BR.
sk.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/9bfd89c9-2961-4af4-b30e-9e5c268f10b8n%40googlegroups.com.

Sun King

unread,
Mar 16, 2022, 9:52:22 PM3/16/22
to Repo and Gerrit Discussion
But the logs showed some webhook is skipped as below

DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://127.0.0.1:29417] skipped.

how to fix this please?

It's very helpful and thank you Sir. 
I can get debug logs of webhooks now.

Matthias Sohn

unread,
Mar 17, 2022, 3:24:38 AM3/17/22
to Sun King, Repo and Gerrit Discussion
On Thu, Mar 17, 2022 at 2:52 AM Sun King <king...@gmail.com> wrote:
But the logs showed some webhook is skipped as below

DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://127.0.0.1:29417] skipped.

how to fix this please?

did you add a webhooks.config' file on project's refs/meta/config branch as described in
 

Sun King

unread,
Mar 17, 2022, 4:54:27 AM3/17/22
to Repo and Gerrit Discussion
在2022年3月17日星期四 UTC+8 15:24:38<Matthias Sohn> 写道:
On Thu, Mar 17, 2022 at 2:52 AM Sun King <king...@gmail.com> wrote:
But the logs showed some webhook is skipped as below

DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://127.0.0.1:29417] skipped.

how to fix this please?

did you add a webhooks.config' file on project's refs/meta/config branch as described in

Yes sir and I have done that.
The webhooks is ok when doing a git push but failed in git tag.
I set event =  patchset-created.
But when pushing a tag , it came into "com.googlesource.gerrit.plugins.webhooks.PostTask : No content."

Any idea is appreciate.
BR.

Matthias Sohn

unread,
Mar 17, 2022, 4:58:18 AM3/17/22
to Sun King, Repo and Gerrit Discussion
On Thu, Mar 17, 2022 at 9:54 AM Sun King <king...@gmail.com> wrote:


在2022年3月17日星期四 UTC+8 15:24:38<Matthias Sohn> 写道:
On Thu, Mar 17, 2022 at 2:52 AM Sun King <king...@gmail.com> wrote:
But the logs showed some webhook is skipped as below

DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://127.0.0.1:29417] skipped.

how to fix this please?

did you add a webhooks.config' file on project's refs/meta/config branch as described in

Yes sir and I have done that.
The webhooks is ok when doing a git push but failed in git tag.
I set event =  patchset-created.
But when pushing a tag , it came into "com.googlesource.gerrit.plugins.webhooks.PostTask : No content."

Pushing a tag is not creating a patchset. In order to get notified for a pushed tag register for the ref-updated event.
 

Sun King

unread,
Mar 17, 2022, 6:29:26 AM3/17/22
to Repo and Gerrit Discussion
Problem resolved and thank you Matthias. You saved me.Cooool. : )

Felipe Santos

unread,
Feb 20, 2025, 9:26:34 AM2/20/25
to Repo and Gerrit Discussion
Matthias,

Sorry for "reopening" this old issue, but I'm facing the same problem, but I'm sure it has nothing to do with the "solution" you provided to Sun.

The error and debug logs points to the very same issue:

```
[2025-02-19T23:38:02.306+01:00] [webhooks-3[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@3360c17d[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@54f3885a[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@463b0b28]]]] ERROR com.googlesource.gerrit.plugins.webhooks.PostTask : Failed to post: Processing event: patchset-created for project: my/project for remote: http://example.com/webhook
[2025-02-19T23:51:57.069+01:00] [webhooks-2[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@ad0e775[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@40942fa3[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@5115753]]]] DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://example.com/webhook] skipped. [CONTEXT PLUGIN="gerrit" PLUGIN="high-availability" PLUGIN="webhooks" project="my/project" ]
```

Note I redacted the project name and the webhook target address. However, this very same configuration was working fine up to some months ago. I'm trying to understand why it stopped working.

According to the source code of the webhooks plugin (I'm running Gerrit 3.4.8), this issue is thrown before the request is made to my server:

https://gerrit.googlesource.com/plugins/webhooks/+/f26cfcedc3cc9cc5bfdbd530abfb4d85314c1c21/src/main/java/com/googlesource/gerrit/plugins/webhooks/PostTask.java#76

Apparently, some internal object isn't being set for whatever reason.

I would really appreciate if you have any insight on what may be happening, I'm clueless. :(

Saša Živkov

unread,
Feb 24, 2025, 8:18:41 AM2/24/25
to Felipe Santos, Repo and Gerrit Discussion
On Thu, Feb 20, 2025 at 3:26 PM Felipe Santos <felipec...@gmail.com> wrote:
Matthias,

Sorry for "reopening" this old issue, but I'm facing the same problem, but I'm sure it has nothing to do with the "solution" you provided to Sun.

The error and debug logs points to the very same issue:

```
[2025-02-19T23:38:02.306+01:00] [webhooks-3[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@3360c17d[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@54f3885a[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@463b0b28]]]] ERROR com.googlesource.gerrit.plugins.webhooks.PostTask : Failed to post: Processing event: patchset-created for project: my/project for remote: http://example.com/webhook
[2025-02-19T23:51:57.069+01:00] [webhooks-2[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@ad0e775[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@40942fa3[Wrapped task = com.google.gerrit.server.logging.LoggingContextAwareRunnable@5115753]]]] DEBUG com.googlesource.gerrit.plugins.webhooks.PostTask : No content. Webhook [http://example.com/webhook] skipped. [CONTEXT PLUGIN="gerrit" PLUGIN="high-availability" PLUGIN="webhooks" project="my/project" ]

The "No content. Webhook ... skipped" message is logged when, based on your webhooks.config, you don't want to post that event type.
Check your etc/webhooks.config and look for remote.NAME.event settings. This is documented in the plugins documentation [1]

Felipe Santos

unread,
Feb 24, 2025, 4:15:55 PM2/24/25
to Repo and Gerrit Discussion
Thank you, Saša Živkov.

I will double check my configuration, I don't think it's wrong, but you gave good clues to continue my investigation.

Have a great day!
Reply all
Reply to author
Forward
0 new messages