TeamCity 从哪里获取 %system.teamcity.build.workingDir% 的值
我们有 TeamCity,在[Build Configuration]
页面的[Runner: Command Line]
上,有一个[Command Parameter]
字段< code>%system.teamcity.build.workingDir%
我的问题是 TeamCity 从哪里获取此值,因为当我查看代理的系统属性时,我没有看到它已设置。 %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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你在哪里看?它与其他系统属性一起列出:
@Snahider - 任何时候的构建仅在一个代理上运行。因此
%system.teamcity.build.workingDir%
将被设置为当前构建的工作目录。它与%system.agent.work.dir%
不同,后者是每个构建的签出目录的父目录。例如,如果您的代理安装在
C:\BuildAgent
中,则%system.agent.work.dir%
将是C:\BuildAgent\work
如果您未在 VCS 设置中指定签出目录,则%system.teamcity.build.workingDir%
将类似于C:\BuildAgent\work\8b0fde2bf2d2efc0
如果您已经设置了它,那么wd
它将是C:\BuildAgent\work\wd
还有一件事是,如果在构建步骤中您更改了工作目录,例如
Examples
,%system.teamcity.build.workingDir%
顾名思义,指向该目录 -C:\BuildAgent\work\ wd\Examples
因此,%system.teamcity.build.workingDir%
可以根据发生的情况进行更改,而%system.agent.work.dir%
将对于代理保持相同。希望这能解释其中的差异。Where are you looking? It is listed along with other system properties:
@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 beC:\BuildAgent\work
whereas%system.teamcity.build.workingDir%
will be something likeC:\BuildAgent\work\8b0fde2bf2d2efc0
if you have not specified the checkout directory in VCS settings or if you have set it, to saywd
it will beC:\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.%system.teamcity.build.workingDir% 文档说:
如果您有 Web 服务器并且仅在同一台计算机上的代理上,则该目录与 %system.agent.work.dir%
http://confluence.jetbrains.net/display/TCD5/Agent+Work+Directory
在我的 Windows 框中是 C: /Users/[用户]/.BuildAgent/work。
如果您有多个代理,我不知道目录是什么。我建议您使用 %system.agent.work.dir% 而不是 %system.teamcity.build.workingDir%。
您可以使用相同的“命令行构建”测试任何变量的值:在“命令参数”输入中写入变量并运行构建,构建完成后您可以在日志中看到真实值。
%system.teamcity.build.workingDir% documentation says:
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.