Is there any way to add a custom merge blocking issue to Bitbucket pull request? - bitbucket

My goal is to add extra restriction to prevent pull request from merging. In my case, I wanna block merge until linked Jira issue will have a specific status.
Is there any REST API or some sort of admin page to do this?

Related

How to capture PR CREATION event in bitbucket

‘’’’
Need to know if there is any possible way to capture the event of pull request creation in bitbucket to write a custom script using this event.
Dont want PR to trigger any automatic build instead just need capture the pr creation event to write a custom python script to trigger certain activities through script run.
One option is to read/continuous poll the bit bucket PR creation page to identify the activity/event but it sounds to be a bad scripting standard and not a good practice.
Is there any git command to identify PR creation at feature branch and to merge into parent(say its DEV) and also git command to capture PR default reviewer names???
So that, these git commandS can be used in script To track if any PR is raised?
Verified many websites and read many articals and unfortunately no where found the possibility to capture the PR creation event in bit bucket?
Great if anyone can post the possibility to capture the event to write our own custom logic with the PR event capture
‘’’’
PR is not a part of git. It's a concept unique to code hosting sites like Bitbucket, Github, etc. Therefore, theoretically it's not possible to capture PR creation event using git tool alone.
You can poll the Bitbucket REST Apis for the PR list. The response is in Json format, stable and easy to parse, so it's not really a bad practice (as when you parse the raw html).
Another way is to set up a Bitbucket webhook that triggers on PR creation event. You then need to run a web server (something like this) to accept the webhook call and run the corresponding scripts.

Pull Request Permission

I have question on ADS GIT Pull request permissions Is there any way to prevent others from being able to change the status your pull request? like being able to publish your draft request, setting the complete status, abandoning etc?
Is there any way to prevent others from being able to change the status your pull request?
Sorry for any inconvenience.
Now, Azure devops service/server doesn't provide a feature to meet this requirement.
To protect the Pull Request, you could add reviewers for the target branch to prevent set the complete status directly.
On the other hand, we could set creator's target branch or repo contribute permission to Deny, you need to add specific user to target Branch security page. This not applied to all the creators all the PRs. Just a specific PR and specific user:
But none of these settings apply to abandon. For this option, you could add your request for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.
Hope this helps.

Getting change id's of depending changes from gerrit rest or ssh api?

Gerrit allows associated external changes into a single change request via "Depends-On" on the commit message. However, by the looks of it, rest api does not expose these dependencies.
I can ofcourse get the commit message and then parse it, and then get change request for this external change.
Anyone know if there would be a bit more streamlined option to archive the same ?
You can get the related changes using REST API:
'GET /changes/{change-id}/revisions/{revision-id}/related'
Retrieves related changes of a revision. Related changes are changes
that either depend on, or are dependencies of the revision.
Request GET
/changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related
HTTP/1.0
See more info in the Gerrit documentation here

Upsource Webhooks and JIRA

I am working on automating the code review process in my team.
My objectives are:
When a review is created, assign it to two random developers
Automatically update the JIRA item, and assign them to the developers who were assigned as reviewers in Upsource
I was able to achieve objective #1 using Upsource Custom Workflows.
For the second objective, I have tried looking at Upsource Webhooks and JIRA Cloud REST API, but I fail to see how to assign a JIRA item from Upsource. JIRA's API specifies that in order to assign an item using REST, we need to create PUT request to this method:
PUT /rest/api/2/issue/{issueIdOrKey}/assignee
How can I create a PUT request from Upsource Webhooks?
How can I extract the {issueIDOrKey} from the originating Upsource review?
How can I create a PUT request from Upsource Webhooks?
Upsource webhooks send only POST requests at the moment. But I don't see how this limitation is blocking your task, because as I understand there has to be a service that'll translate Upsource payload to JIRA payload. That service should make a PUT request.
How can I extract the {issueIDOrKey} from the originating Upsource review?
Upsource provides an API for this. getReviewDetails method allows to get a list of issues associated with a given review (see this message spec).

Default reviewers in TFS

Our company is using Team Foundation Server 2015. Is it possible to add one or several persons automatically as reviewers to every pull request? As required default reviewers?
Yes, you can add default reviewers to pull requests quite easily.
If you configure your branch policy you can have different reviewers occur for different code paths. If you want to add default reviewers to all pull requests for that code path you can specify "/*" in the path box. They will then be added to every pull request.

Resources