【问题标题】:TFS linux agent ignores Build.Repository.Clean variableTFS linux 代理忽略 Build.Repository.Clean 变量
【发布时间】:2020-06-10 14:49:23
【问题描述】:

情况:

  • TFS 2018

  • 构建过程包括两个阶段——分别在 Windows 和 Linux 代理上执行

  • Get sources (TFVC) 将 Clean 标志设置为 false

问题:

  • Linux 代理(与其对应的不同)忽略 Clean 标志 -- 它始终执行 tf workspace -delete... -new 等。

我添加了“打印变量”步骤,可以清楚地看到Build.Repository.Clean 在每个阶段都是false

有没有办法解决这个问题?

更多信息:

system.debug 设置为true 会产生有趣的日志:

Querying workspace information.
##[debug]tf workspaces -format:xml "-collection:<tfs-server-url>" -jwt:******** -noprompt
##[debug]No workspace matching *;Project Collection Build Service (<collection-name>) on computer <computer-name> found in Team Foundation Server <tfs-server-url>.
##[debug]<?xml version="1.0" encoding="utf-8"?><workspaces/>
##[debug]Sources directory does not exist or is empty.
##[debug]tf workspaces ws_1_14 -computer:* -format:xml "-collection:<tfs-server-url>" -jwt:******** -noprompt
##[debug]No workspace matching ws_1_14;Project Collection Build Service (<collection-name>) on computer * found in Team Foundation Server <tfs-server-url>.
##[debug]Deleting: '/home/<user>/agent/_work/1/s'.
##[command]tf workspace -new -location:local -permission:Public ws_1_14 "-collection:<tfs-server-url>" -jwt:******** -noprompt
Workspace 'ws_1_14' created.

但是当我登录到那台机器并自己运行这些命令时(没有-jwt:... -noprompt)——我得到了关于ws_1_14 工作区的正确信息。代理正在作为通过sudo ./svc.sh install; sudo ./svc.sh start 创建的守护程序/服务执行。这意味着问题出在该守护进程的环境中。

【问题讨论】:

  • 您可以将“system.debug”变量设置为“true”的构建排队,然后共享构建日志吗?您是否在 Get Sources 和构建步骤中都将 Clean 设置为 false?你是如何映射你的文件夹的?
  • @CeceDong-MSFT 我已经用其他信息更新了我的帖子。知道如何追踪为什么代理从 TFS 获得“无工作区...”响应吗?

标签: tfs azure-devops tfsbuild


【解决方案1】:

发生这种情况是因为我的 hostname 是 FQDN(而不是短名称)。这是一个existing bug

解决方案是将主机名更改为短且不带点(例如sudo hostnamectl set-hostname shortname)并再次运行构建(它将在Computer 列中重新创建具有短主机名的工作区)并且所有后续构建都应该可以正常工作。

【讨论】:

  • 很高兴看到您解决了您的问题。请Accept it as an Answer,这可能对阅读此主题的其他社区成员有所帮助。
  • @CeceDong-MSFT 24 小时无法接受我自己的回答 :)
猜你喜欢
  • 1970-01-01
  • 2016-02-12
  • 2016-07-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-03
  • 1970-01-01
  • 1970-01-01
  • 2023-04-03
相关资源
最近更新 更多