Binding Dynamic Build Definitions To GitHub Repos
How to make sure that you maintain flexibility of your builds when working with GitHub repositories.
By Den in Hackery
November 4, 2016
As part of the project that I am working on, I need to make sure that I allow the user to specify what GitHub repository they want to bind to their Visual Studio Team Services build definitions. As part of the project that I am working on, I need to make sure that I allow the user to specify what GitHub repository they want to bind to their Visual Studio Team Services build definitions. I am using the library for that, but no matter what I tried, the repository just did not show up.
For the process, I was using a typical BuildHttpClient instance. All seemed smooth, but I always ended up with a failed repository binding in the VSTS UI:
And while I got the red exclamation mark there, I got the correct repository binding in the build definition preview:
So what’s the deal? You’d likely use a code snippet like this:
|
|
Number one – make sure to add the .git prefix to the repository ID when you are creating a new BuildRepository. But that still won’t be enough. Take a look at the second part of the above code snippet:
|
|
Notice that you need to specify values for gitLfsSupport and fetchDepth. Without those properties in place the binding will not happen, so be careful!
Once these tweaks were made, I could successfully bind my repository to the definition.
Feedback
Have any thoughts? Let me know over email by sending a note to hi followed by the domain of this website.