Delays for commits to display in Development Panel in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Commits from either Bitbucket or GitHub are slow to appear in JIRA after they have been made.  Often commits are not seen for up to 1 hour. 

Diagnosis

Users are not seeing Commits appear in JIRA after they have been made. By default, JIRA checks for updates every 60 minutes unless the commit is pushed by the Repository or a SmartCommit was used.

Cause

When setting up the DVCS Connection, the OAuth Token provided did not come from an account with high enough permissions to be able to create webhooks in the Repository Environment.  The connection can be established however the webhooks to POST Commits and Updates back to JIRA were not added.  

In the JIRA Logs:

WARN ... /secure/admin/AddGithubOrganization!finish.jspa [plugins.dvcs.service.RepositoryServiceImpl] Adding postcommit hook for repository https://github.com/TEAM/repo failed. Probably insufficient permission

Viewing the Webhooks from within Bitbucket or GitHub show that there are no WebHooks configured to send POST messages back to the JIRA instance.

Resolution

  • Recreate the OAuth Token with an account with sufficient permissions to create the webhooks
  • Re-add the repositories or the organizations
    (info) The errors only show up in the logs by default when adding organizations. When adding repositories, the errors show up in the UI - to make them appear in the logs, add the com.atlassian.jira.plugins.dvcs package as INFO.

Workaround - Jira 8.14 or higher

If an elevated account cannot be used or is unavailable, the webhooks will need to be created manually for each repository:

Starting in Jira 8.14, the URL doesn't contain the repository ID, so if all repositories are being synchronized, you can set the webhooks org-wide, even though that's not what the DVCS plugin does.
The steps below show how to create the webhook for each repository.

Bitbucket

  1. Go to your Bitbucket repository settings.

  2. Go into "Services" underneath the Integrations heading at the left.

  3. Choose "POST" from the dropdown and hit Add Service.

  4. Put the following URL in:

     https://<Jira-Base-URL>/rest/bitbucket/1.0/webhook/bitbucket

Github

You will need to create 2 Webhooks

  1. Go to your GitHub repository settings.
  2. Go into "Webhooks & Services" > "Add Webhook"
  • WebHook #1
    1. Payload URL:

       https://<Jira-Base-URL>/rest/bitbucket/1.0/webhook/github
    2. Content type: application/json
    3. Which events would you like to trigger this webhook: Just the push event

    4. Check "Active"
    5. Add Webhook
  • WebHook #2
    1. Payload URL:

       https://<Jira-Base-URL>/rest/bitbucket/1.0/webhook/github
    2. Content type: application/json
    3. Which events would you like to trigger this webhook: Let me select individual events
      1. Check the Following:
        1. Pull Request
        2. Issue comment
        3. Pull Request review comment
    4. Check "Active"
    5. Add webhook


Workaround - Jira 8.13 or lower

If an elevated account cannot be used or is unavailable, the webhooks will need to be created manually for each repository:

Repository ID

To get a list of the repositories that the JIRA DVCS plugin is currently aware of and their associated IDs, you can use the API call below to return an XML listing of all repositories.

GET https://<Jira-Base-URL>/rest/bitbucket/1.0/repositories

Bitbucket

  1. Go to your Bitbucket repository settings.

  2. Go into "Services" underneath the Integrations heading at the left.

  3. Choose "POST" from the dropdown and hit Add Service.

  4. Put the following URL in:

     https://<Jira-Base-URL>/rest/bitbucket/1.0/repository/<repository id>/sync

Github

You will need to create 2 Webhooks

  1. Go to your GitHub repository settings.
  2. Go into "Webhooks & Services" > "Add Webhook"
  • WebHook #1
    1. Payload URL:

       https://<Jira-Base-URL>/rest/bitbucket/1.0/repository/<repository id>/sync
    2. Content type: application/x-www-form-urlencoded
    3. Which events would you like to trigger this webhook: Just the push event

    4. Check "Active"
    5. Add Webhook
  • WebHook #2
    1. Payload URL:

       https://<Jira-Base-URL>/rest/bitbucket/1.0/repository/<repository id>/sync
    2. Content type: application/json
    3. Which events would you like to trigger this webhook: Let me select individual events
      1. Check the Following:
        1. Pull Request
        2. Push
        3. Issue comment
        4. Pull Request review comment
    4. Check "Active"
    5. Add webhook

(info) Note: The endpoint for the DVCS connector is contains /bitbucket/ even for GitHub.

DescriptionCommits from either Bitbucket or GitHub are slow to appear in JIRA after they have been made.  Often commits are not seen for up to 1 hour. 
ProductJira
PlatformServer
Last modified on Aug 3, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.