Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does TeamCity get the value for %system.teamcity.build.workingDir%

We have TeamCity and on the [Runner: Command Line] of the [Build Configuration] page, there is a [Command Parameter] field %system.teamcity.build.workingDir%

My question is where does TeamCity get this value from as when i look at the System Properties of the Agent i do not see it has been set. %system.teamcity.build.workingDir% does not appear in the list of [System Properties] or [Environment Variables]

like image 383
EalesJS Avatar asked May 13 '11 03:05

EalesJS


People also ask

What is TeamCity build Workingdir?

The build working directory is the directory set as current for the build process. By default, this is the same directory as the build checkout directory.

What is parameter in TeamCity?

Last modified: 30 August 2022. Build parameters are name-value pairs, defined by a user or provided by TeamCity, which can be used in a build. They help flexibly share settings and pass them to build steps.


2 Answers

Where are you looking? It is listed along with other system properties:

enter image description here

@Snahider - a build at any point runs only on one agent. So %system.teamcity.build.workingDir% will be set to the current build's working dir. It is not same as %system.agent.work.dir% which is the parent of the checkout directory for each build.

For example if you have your agent installed in C:\BuildAgent the %system.agent.work.dir% will be C:\BuildAgent\work whereas %system.teamcity.build.workingDir% will be something like C:\BuildAgent\work\8b0fde2bf2d2efc0 if you have not specified the checkout directory in VCS settings or if you have set it, to say wd it will be C:\BuildAgent\work\wd

One more thing is that, if in the build step step you change the working directory, to say Examples, %system.teamcity.build.workingDir% will, as the name suggests, point to that - C:\BuildAgent\work\wd\Examples So %system.teamcity.build.workingDir% can change depending on what is happening, while %system.agent.work.dir% will remain same for an agent. Hope this explains the difference.

like image 151
manojlds Avatar answered Oct 08 '22 01:10

manojlds


%system.teamcity.build.workingDir% documentation says:

The build working directory is the directory set as current for the build process. By default, this is the same directory as the Build Checkout Directory. If the build script needs to run from a location other than the checkout directory, then you can specify it explicitly using the Working Directory field on the settings page of the build runner.

If you have the WebServer and only on Agent in the same machine that directory is the same as the %system.agent.work.dir%

http://confluence.jetbrains.net/display/TCD5/Agent+Work+Directory

In my windows box is C:/Users/[user]/.BuildAgent/work.

if you have multiple agents i dont know what will be the directory. I recommend you to use %system.agent.work.dir% instead of %system.teamcity.build.workingDir%.

You can test the value of any variable using the same "command line build": write the variable in the "Command Parameters" input and run the build, you can see the real value in the logs when the build finshed.

like image 44
Snahider Avatar answered Oct 08 '22 03:10

Snahider