TFS linux 代理忽略 Build.Repository.Clean 变量
TFS linux agent ignores Build.Repository.Clean variable
情况:
TFS 2018
构建过程包括两个阶段——分别在 Windows 和 Linux 代理上执行
Get sources
(TFVC) 将 Clean
标志设置为 false
问题:
- Linux 代理(不像它的对手)忽略
Clean
标志——它总是执行 tf workspace -delete
、... -new
等
我添加了 "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
列中重新创建具有短主机名的工作区)和所有后续构建应该可以正常工作。
情况:
TFS 2018
构建过程包括两个阶段——分别在 Windows 和 Linux 代理上执行
Get sources
(TFVC) 将Clean
标志设置为false
问题:
- Linux 代理(不像它的对手)忽略
Clean
标志——它总是执行tf workspace -delete
、... -new
等
我添加了 "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
列中重新创建具有短主机名的工作区)和所有后续构建应该可以正常工作。