Git Integration for Jira Self-Managed (Data Center/Server) Documentation

Contact Support
GitKraken Status  

Adding webhooks for Gerrit

 

Introduction

Webhooks are not configured by default in Gerrit. They are not built into Gerrit just like they are in GitHub, GitLab and etc. Thus, when calling Gerrit webhooks, these won’t trigger the reindex of the integration / repositories.

 

Installation

To use webhooks with Gerrit, it needs to be configured.

For starters, install Gerrit with the webhook plugin by reading at https://gerrit.googlesource.com/plugins/webhooks/ and the steps below.

Project (repository) list:

curl http(s)://your.org.com:8080/projects/?d

Enabled webhooks for the repository, for example, MyTestRepo:

curl http(s)://your.org.com:8080/config/server/webhooks~projects/MyTestRepo/remotes

Add webhook for the repository:

curl --user username:password -H 'Content-Type: application/json' -X PUT -d @webhook.json http(s)://your.org.com:8080/a/config/server/webhooks~projects/MyTestRepo/remotes/bbb-webhook

Where webhook.json:

{
   "url" : "https://example.com/webhook/url",
   "maxTries" : 3,
   "sslVerify": true
}

 

Manually Trigger Webhooks

Create a webhook that can be triggered for any individual repository. It can be used with continuous integration service

Required headers:

  • ‘x-bbb-webhook-type’: PUSH

  • ‘Content-Type’: application/json

Optional headers:

  • ‘x-bbb-webhook-id’ — Can be any string representing the id of the request to be used.

Usage examples:

curl -H 'x-bbb-webhook-type: push' -H 'content-type: application/json' -X POST -d @payload.json https://webhook/url
curl -H 'x-bbb-webhook-type: push' -H 'x-bbb-webhook-id: id-string' -H 'content-type: application/json' -X POST -d @payload.json https://webhook/url

Payload.json

{  
    "origin": "repository-origin"
}

 

More related articles about webhooks setup

Creating reindex triggers for a single repository

Adding webhooks for GitHub

Adding webhooks for GitLab

Webhooks GitHub Organization support

Adding webhooks for Azure DevOps Repos | VSTS

Adding webhooks for Azure DevOps Server | TFS

Adding webhooks for Bitbucket

Adding webhooks for Gerrit (this page)

Have feedback about this article? Did we miss something? Let us know!
On this page