Search code examples
tfstfsbuild

Team Foundation Server TFS Build triggered from Subversion SVN Tag


I'd like to be able to trigger a build in TFS Build when a developer tags in Subversion. I'd also like to use the tag number as part of the build and release name. Is this possible in TFS right now?


Solution

  • There is no this built-in trigger for building a repository type of subversion in TFS.

    You could first get the event (a developer create a tag in svn) from SVN. Not sure how to do this in SVN, should be something like the service hooks in TFS. Then trigger a build in TFS 2017 using REST API. How to do this please refer: How to trigger a build in TFS 2015 using REST API

    As for how to use the tag number as part of the build and release name, see below:

    Create custom build number during build

    With Team Build you can update the build number at any time during the build by outputing "##vso[build.updatebuildnumber]1.2.3.4" to the log during the build.

    You can see the full list of logging commands here https://github.com/Microsoft/vso-agent-tasks/blob/master/docs/authoring/commands.md

    This will update the build number & name.

    The down side that you have run into is that you can no longer use the auto-incrementing number that you have been trying to use. You need to come up with the version number yourself, and then pass it back using the output above.

    Source

    Add two more related blogs: