Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to define the default reviewers in the Curl command for creating pull request from Jenkins?

lokanathan Vanchinathan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2018

Dear all, 

I have a Jenkins job that does the build and in the post build actions, i have a script that runs the Curl command (shown below) where there is this $payload given for the '-d' option.  This payload is a Json string that defines the details of the pull request and the reviewers list.

 curl -X POST -H "Content-Type: application/json" -H 'X-Atlassian-Token: no-check' -u {username}:{password}  https://server:port/rest/api/1.0/projects/{projectkey}/repos/{reponame}/pull-requests -d '{ "title": "Merge some branches", "description": "testing", "fromRef": { "id": "tag/branch" , "repository": { "slug":"reponame", "project": { "key": "projectkey" } } }, "toRef": { "id": "destination-branch"  }, "reviewers": [ { "user": { "name": "username-who-has-access-rights"} } ], "close_source_branch": false }'

This above command is able to create the pull request in the Bitbucket server repo, but is not able to set the reviewers, even though the "reviewers" are set in the Json and these users are valid users in Bitbucket for corresponding repository.

Please give guidance to setup this curl  command to set the "default reviewers", which i do not now how to, and i do not need to specify this reviewers list in the curl command. 

Many a thanks to all.

-vanchin

1 answer

0 votes
lokanathan Vanchinathan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2018

Dear all,

Just figured out one of the two issues:

1. Valid reviewers were not set in the pull request. 
           Here I just realized that BitBucket allows to stores the userIds in UPPER and lower cases. In this case "USERID" is not the same as "userid". So the userid that were supplied in lower case tend to become invalid because that userid was stored in UPPER-CASE.  

Is it possible for Atlassian to check against the userids with in-case sensitivity or only allow the user ids to be stored either in one format? 

2. Still not able to figure how to set the "default reviewers" for the pull request through the "curl" command.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events