Documentation

Webhooks

Trigger immediate reindex of your repositories from remote systems via webhooks. For more information about this topic, see About GitLab Webhooks.

Adding Webhooks to Connected Repositories (Jira Seerver)

Go to Administration > Applications. Under Git Integration Plugin for Jira on the sidebar, select Webhooks.

Git Repositories reindex web hook

Enable/disable the webhook feature by clicking on the Enable webhook checkbox.

The Secret Key is a secure random-generated alphanumeric string at the time of the Git add-on installation. The user can change this to a different value by generating another secret token according to the Git host.

Use this key in the form of:

<JIRA_BASE_URL>/git/webhook/reindex/<SECRET_KEY>

Assign your Jira base URL and Secret Key to the sample URL structure:

Example:

https://your.jira.com/rest/gitplugin/webhook/1.0/reindex/sdf34tGdfgGDG345g3y0045TYG23te37

Adding Webhook for GitHub Repository

Configure webhook by logging in to your GitHub account:

  1. Select a repository.
  2. Go to the Settings page.Github webhook settings
  3. Select Webhooks & services.
  4. Click Add webhook. The following page is displayed:GitHub Webhooks - Add webhook
  5. Paste the obtained Secret URL from the Git Integration for Jira add-on > Webhooks page into the Payload URL field.
  6. Select the Just the push event option as triggering event. This is the default option when creating a new webhook.
  7. Click Add webhook to save the new webhook settings.

Webhooks will be automatically registered for each GitHub repository connected to JIRA Cloud to instantly index your commits. For this to work, the connecting GitHub user must be the Organization Owner or have repository ADMIN rights.

Webhooks will be deleted when GitHub integration is disconnected from Git for JIRA Cloud.

Adding Webhook for GitLab Repository

Configure webhook by logging in to your GitLab account:

  1. Select a repository.
  2. Go to the settings page by clicking the settings icon, then
  3. Select Webhooks.Gitlab webhooks settingThe following page is displayed:GitLab Webhooks - Add webhook
  4. Paste the obtained Secret URL from the Git Integration for Jira add-on > Webhooks page into the Payload URL field.
  5. Select the Push events as a triggering event option. This is the default option when creating a new webhook.
  6. Click Add webhook to save the new webhook settings.

Adding Webhooks to Connected Git Repositories (Jira Cloud)

Before you can add a webhook to your favorite git repository, you need to enable it in the git repositories configuration page.

Click the Git menu on your Jira Dashboard, then select Manage Git Repositories.

The following screen is displayed:

Manage Git Repositories page Webhooks

Click Webhooks.

On the following dialog, enable/disable the webhook feature by clicking on the Enable webhook checkbox.

Enable webhooks screen

When enabled, the Git Integration app will also provide a webhook URL for use with the repository webhooks setting of your git host.

Copy the webhook URL to the system clipboard by clicking the copy to clipboard icon icon.

Click Save to save the settings.

After enabling the webhooks feature, you can access the webhook URL from the other locations in the Manage Repositories page:

  • Click a tracked repository or a single repository URL in the Git repositories list.Tracked repositories webhook URL source access
  • Click the Actions icon for the connected single repository then select Edit. For the connected tracked repository, select Show tracked repositories then click a repository URL on the next screen.

Watch the video below to learn on how to add webhooks to your connected git repositories in Jira Cloud. It covers adding webhooks to GitHub, GitLab, Bitbucket Cloud and VSTS and shows where to get the webhook URL.

Webhook GitHub Organization Support

As of v2.12.8 of the Git Integration for Jira add-on, GitHub Organization webhooks is now supported. Rather than creating a webhook for each repository manually, configure the webhook at the GitHub Organization level to automatically register webhook for each repository.

GitHub Organization Webhooks - Adding webhook

To configure GitHub organization webhook:

  1. Login to your GitHub account and go to your GitHub Organization.
  2. Go to Settings.
  3. Under Organization Settings, go to Webhooks.
  4. Click Add webhook.
  5. Paste the webhook URL into the Payload URL field. (The webhook url is acquired from the Git Integration for Jira add-on webhook configuration page.)
  6. Select/enable the "Just the Push event" trigger.
  7. Click Add webhook to complete this setup.

GitLab/GitHub Push Events

The Git Integration for Jira app supports GitLab and GitHub push event to define individual repository to index.

The webhook parses the following payload formats:

GitLab

{
    "repository": {
    "git_ssh_url": "git@gitlab.com:testuser01/test-master.git",
    "git_http_url": "https://gitlab.com/testuser01/test-master.git"
  {
}

Github (Introduced v2.7.10)

{
    "repository": {
    "git_url": "git://github.com/testuser01/test-repo.git",
    "ssh_url": "git@github.com:testuser01/test-repo.git",
    "clone_url": "https://github.com/testuser01/public-repo.git",
    "svn_url": "https://github.com/testuser01/public-repo"
  {
}

Creating Reindex Triggers for a Single Repository

To create a webhook that triggers the reindex of a single repository, the following requirements are required:

  1. The git_http_url matches the Repository Origin URL from the Jira git configuration page (Git > Manage repositories > Actions > Edit integration settings).
  2. The Content-Type request header is set to application/json.
  3. Use the webhook secret key from the git configuration page > Webhooks.

The webhook is a POST request with the following JSON body:

{
  "repository": {
    { "git_http_url": "https://gitlab.com/bbb-dev/bbb-testrepo.git" }
}
For example:
Webhook reindex trigger POST API example
Result:

The repository is placed in the indexing queue in the Git > Manage git repositories configuration page.

Related articles

Also read our Webhooks Setup guide in Confluence.

Get new product notifications and feature updates from BigBrassBand LLC.

Subscribe to our mailing list