3

We are using VSTS for our build server and for version control.

As part of our build process I would like to create a Pull Request from master branch to develop branch (for build running on master only). I know there is an API endpoint to do that.

But I wonder if there is a better way to handle it? Like a custom step that does it (and I've missed it)?

trailmax
  • 34,305
  • 22
  • 140
  • 234
  • I wonder what you are trying to achieve here. A more standard flow is to create a pull-request and have your build run after the pull-request has been completed. I always use 'Branch policies'. This allows you to protect your brach. One of the options is to add a build that has to pass to be able to complete the pull-request. https://learn.microsoft.com/en-us/vsts/git/branch-policies#require-a-successful-build – E. Staal Nov 04 '17 at 19:15
  • @E.Staal some devs in my team are lazy and don't merge bugfixes from where merged into `master` also into `develop`. And when time comes, `develop` branch is behind `master` for a lot of fixes and it can be a pain to merge later. – trailmax Nov 04 '17 at 22:55
  • So, if you want changes to be merged to develop automaticly, why not skip master anyway? Another way to do this is to make this late integration visible on a monitor. Use the api to visualize who ‘forgot’ to merge his change to develop. Change the behavior instead of solving the result – E. Staal Nov 05 '17 at 07:57

2 Answers2

2

You can install the Create Pull Request extension, it gives you the ability to create a pull request automatically from your build pipeline:

enter image description here

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
1

For now, there is no better way for that.

Even if you use a webhook to trigger the event when the build is successful for master branch, the main step is to use the REST API to create a PR. And there is no such extension task in marketplace.

But in the future, when the server side hooks are available for VSTS, you can use post-push hook to update develop branch automatically after changes are merged from bugfix branch into master branch.

progmatico
  • 4,714
  • 1
  • 16
  • 27
Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Thanks for confirming - VSTS API is easy enough to use, we'll probably go with it. Also we found this plugin: https://marketplace.visualstudio.com/items?itemName=kerwincarpede.GitflowBranchGate - it might help with what we are trying to do - just FYI. – trailmax Nov 06 '17 at 10:04