-
Bug
-
Resolution: Unresolved
-
Low (View bug fix roadmap)
-
None
-
7.4.0, 7.10.0
-
7.04
-
12
-
Severity 2 - Major
-
1
-
Summary
When JIRA is integrated with Bitbucket Cloud using DVCS, currently 2 POST services will be created in Bitbucket Repo Settings -> Services, one to send Commits updates and one to send Pull Requests updates to JIRA:
These 2 services use the same REST endpoint:
<JIRA_Base_URL>/rest/bitbucket/1.0/repository/<Repo_ID>/sync
In the future, Webhooks will replace Services, however currently it seems JIRA DVCS fails to update Commits sent by Bitbucket Cloud Webhooks.
Steps to reproduce
- Integrate JIRA with Bitbucket Cloud
- Go to Bitbucket Repo Settings -> Services -> copy the URL (as above)
- Delete the services (the Services menu will disappear if there's no more service)
This is to ensure only Webhooks will take effect
- Go to Bitbucket Repo Settings -> Webhooks -> create a new Webhook like this (use the URL from step 2 & ensure Commit (Repository) Push and Pull Request Created are selected as triggers):
- Make a new Commit mentioning a JIRA issue key in the commit message
- Create a Pull Request mentioning the same JIRA issue key in the pull request title
Expected behavior
Both the Commit and Pull Request appear immediately in the Development Panel of the JIRA issue.
Actual behavior
Only the Pull Request appears. The Commit doesn't appear until JIRA manually syncs the repo.
Suspected Cause
The following logs are seen when Commits are sent to JIRA:
2017-08-24 06:30:38,593 http-nio-8080-exec-19 INFO anonymous 390x1135x1 - 104.192.143.193 /rest/bitbucket/1.0/repository/1/sync [c.a.j.p.d.r.external.v1.RepositoryResource] Pull Request Postcommit hook started synchronization for repository [1]. 2017-08-24 06:30:38,594 http-nio-8080-exec-19 DEBUG anonymous 390x1135x1 - 104.192.143.193 /rest/bitbucket/1.0/repository/1/sync [c.a.j.p.d.r.external.v1.RepositoryResource] Rest request to soft sync pull requests for repository [1] with type [push]
Looks like it tries to update Pull Requests instead, with a conflicting type:
Rest request to soft sync pull requests for repository [1] with type [push]
The following logs are seen when Pull Requests are sent to JIRA:
2017-08-24 06:32:25,865 http-nio-8080-exec-19 INFO anonymous 392x1150x1 - 104.192.143.194 /rest/bitbucket/1.0/repository/1/sync [c.a.j.p.d.r.external.v1.RepositoryResource] Pull Request Postcommit hook started synchronization for repository [1]. 2017-08-24 06:32:25,865 http-nio-8080-exec-19 DEBUG anonymous 392x1150x1 - 104.192.143.194 /rest/bitbucket/1.0/repository/1/sync [c.a.j.p.d.r.external.v1.RepositoryResource] Rest request to soft sync pull requests for repository [1] with type [pullrequest]
Notes
From Bitbucket Cloud Webhooks logs, the Webhook requests are triggered with the correct types and payloads (request body):
Workaround
Use Services instead of Webhooks.
1. If the Services menu is missing, run this curl command to activate it:
curl -X POST -u <username>:<password> https://api.bitbucket.org/1.0/repositories/<username>/<repository_name>/services/ -d "type=POST&URL=https%3A%2F%2Fbitbucket.org/post"
- Replace Bitbucket username, password, and repository name accordingly.
2. From the Services menu, add these 2 services:
- POST
- Pull Request POST
For both services, use the Webhook URL:
<JIRA_Base_URL>/rest/bitbucket/1.0/repository/<Repo_ID>/sync
3. Deactivate the Webhook
- is incorporated by
-
JSWSERVER-14187 JIRA and GitHub link creates 2 Webhooks
-
- Closed
-
- links to
The old Services functionality that the workaround talks about using appears to be removed from Bitbucket Cloud now. This leaves us in a situation where it is no longer possible to use post commit hooks to update commit info in on-premise Jira instances... Is there any other workaround for this? Or can we patch the existing versions of on premise Jira to properly support the webhook calls?