How to configure TFS to run a build (which is a CI build) for every pull request (when is created and updated).
The scenario that I would like to have is that when a developer completes its work and pushes a branch to GIT (on TFS) it would be nice to check if the build actually compiles and all the tests are passing.
I can create a build for a branch that exists and monitor changes there but how to configure this for branch that will be created later and how to trigger this build when pull request is created.
You can use wildcards in the branch name. So if you create your pull request branches on the server with a naming pattern to them, such as "pr-myrequest", you can add that to the server's CI settings:
There is a little blurb on this topic in the guidance on MSDN.
Git: Specify the repository and the branches that contain the files that your build process requires.
Tip
In the list of branches monitored for continuous integration (CI) and rolling builds, you can use wildcards. For example, you could specifyrefs/heads/feature*
to monitor therefs/heads/featureA
andrefs/heads/featureB
branches.
You can use a /
in the branch naming, which may be provide a clear way to name the branches. This would lead to: refs/heads/pr/*
as an include and your branch names would have to be prifixed with pr/branchname
to be built automatically.