6

I am using TeamCity as build server and have a little trouble when configuring projects and their dependencies.

Eventually I want to get the checkout directory of project dependencies to configure certain build steps. For that I have the variable %teamcity.build.checkoutDir% for the checkout directory of the project itself.

However, I did not find something like %dep.<dependencyID>.teamcity.build.checkoutDir%.

Is there a way to get the checkout directory of a dependency?

1
  • Am I correct in understanding that the goal here is to use files that are generated by "build config 1" in "build config 2"?
    – Paul Hunt
    Apr 29, 2015 at 14:41

2 Answers 2

12

You can add a parameter (say checkoutDir ) in the first build whose value is equal to %teamcity.build.checkoutDir% . You can then fetch this value in the dependent build (either through snapshot or artefact dependency)

1
  • Ah. Good idea, Thanks!
    – Stefan
    May 1, 2015 at 20:29
1

I am using this myself and I can access my dependent Build's Checkout directory with...

%dep.<dependecyID>.teamcity.build.default.checkoutDir%

I believe this will only work with a Snapshot Dependency though

4
  • This seems to work for dependencies that are checked out to a folder with automatic naming. If a specify the folder manually I only got a string like 554523b6395b2878 which also did not point to the right folder
    – Stefan
    Apr 29, 2015 at 13:26
  • I think you will find that your custom folder will sit inside that folder of 554523b6395b2878. Eg D:\BuildAgent\Work\554523b6395b2878\MyCheckoutFolder. If this is the case, you might be able to Setup a parameter for the name of your Custom Checkout Directory, use this Parameter in the VCS Checkout Directory instead of hard coding, and then reference the path using %dep.<dependecyID>.teamcity.build.default.checkoutDir%\%MyCustomCheckoutPath% ????
    – jonhoare
    Apr 29, 2015 at 16:28
  • 1
    If you want the full path you will have to get the Agent path + the checkoutDir and your custom relative path. Eg. %teamcity.agent.home.dir%\%dep.<dependecyID>.teamcity.build.default.checkoutDir%\%MyCustomCheckoutPath%
    – jonhoare
    Apr 29, 2015 at 16:40
  • Yes, that's the way I do it now. I still lack a way of refering via a variable to a non-default path.
    – Stefan
    Apr 30, 2015 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.