Reputation: 49
Is there a way to trigger/queue a build on VSTS using an SVN post-commit-hook? Our svn repository is behind a firewall so isn't visible to VSTS for the built in polling it offers. But I want to be able to queue builds after changes to trunk. Is this possible?
Upvotes: 3
Views: 458
Reputation: 49
Yes I was able to get this working.
Used curl to do the post from our linux svn server. Also we've found it only works with logged in user details (email and PersonalAccessToken) so it labels them to the same user - haven't found how to get it to be specific to the person that committed yet. We were able to change some settings via the JSON, such as the build reason for example.
This is the post-commit we have in place at the moment. (with redacted details)
curl -u {[email protected]:PersonalAccessToken} -H "Content-Type: application/json" -g https://dev.azure.com/{account}/{project}/_apis/build/builds?api-version=4.1 -d "{ \"definition\": { \"id\":1}, \"reason\":\"individualCI\" }" &
Upvotes: 1
Reputation: 114641
You can use the REST API of Visual Studio Team Services to queue a build. That should be doable from a hook or something polling the SubVersion server locally.
POST https://{accountName}.visualstudio.com/{project}/_apis/build/builds
?ignoreWarnings={ignoreWarnings}&checkInTicket={checkInTicket}&api-version=4.1
Upvotes: 4