TeamCity, how to get names of the files edited

南楼画角 提交于 2020-01-01 04:36:30

问题


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,


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/20332397/teamcity-how-to-get-names-of-the-files-edited

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!