Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create pull request if jenkins job running on feature branch is successful

Is there a Jenkins plugin for creating pull requests?

Suppose I am running a Jenkins job on some feature branch. If this job is successful, then I want Jenkins to automatically create a pull request from this feature branch.

There is a command-line way to create pull requests:

git request-pull [-p] <start> <url> [<end>]

but I haven't been able to find a way to get Jenkins to automate the task.

like image 695
thinkingmonster Avatar asked Nov 08 '22 22:11

thinkingmonster


1 Answers

Your Jenkins job can have a step calling the Atlassian Stash API for creating a pull request

POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests?direction&at&state&order&withAttributes&withProperties 

Create a new pull request between two branches. The branches may be in the same repository, or different ones. When using different repositories, they must still be in the same {@link Repository#getHierarchyId() hierarchy}.

The authenticated user must have REPO_READ permission for the "from" and "to" repositories to call this resource.

like image 52
VonC Avatar answered Nov 15 '22 04:11

VonC