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



情况:

  • 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创建的守护进程/服务执行。这意味着问题出现在守护进程的环境中。

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

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

相关内容

最新更新