Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity, how to get names of the files edited

I am using TeamCity and I am new to it. I have added a Build Configuration to the TeamCity and I created one VCS root to attach to it.

However, my project have a special requirement to detect a particular file that was changed in the VCS root location and use that file in build step. I am sure this could be done in TeamCity, I am not able to figure out how.

Any help? Thanks,

like image 322
Newbee Avatar asked Dec 02 '13 15:12

Newbee


2 Answers

To get the names of the files changed this is what I did. Thanks to Sam Jones.

I used System.TeamCity.build.changedFiles.file variable as follows.

  1. Add a command line build step
  2. Select Run as Custom Script
  3. Add the script copy "%system.teamcity.build.changedFiles.file%" changelog.txt in script box.

You will get the changes in changelog.txt file in the format specified on this link.

NOTE: teamcity.build.changedFiles.file does not work. You need to use system.teamcity.build.changedFiles.file

like image 61
Newbee Avatar answered Nov 12 '22 13:11

Newbee


It sounds like you want a VCS Trigger that specifies VCS Trigger Rules, so that a build configuration will run when someone makes a change to a particular file. The documentation has some nice examples of how to do this. If you're trying to trigger a build on one particular file, try this:

+:foo/bar.txt

This excludes all files from the trigger rule and then includes bar.txt in the foo directory. Paths are relative to the root of the repository (do not include a preceding slash). If someone modifies foo/bar.txt, the build configuration will be triggered to run.

VCS Trigger Rules also support pattern matching and all sorts of other options. Check out the documentation.

like image 20
Sam Jones Avatar answered Nov 12 '22 14:11

Sam Jones