TFS linux 代理忽略 Build.Repository.Clean 变量

TFS linux agent ignores Build.Repository.Clean variable

情况:

问题:

我添加了 "print variables" 步骤,可以清楚地看到 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 创建的 daemon/service 执行。这意味着问题出在该守护进程的环境中。

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

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