1

情况:

  • TFS 2018

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

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

问题:

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

我添加了“打印变量”步骤,并且可以清楚地看到它Build.Repository.Cleanfalse每个阶段。

有没有什么办法解决这一问题?

更多信息:

设置system.debugtrue产生有趣的日志:

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。这意味着问题出在该守护程序的环境中。

4

1 回答 1

0

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

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

于 2020-02-27T19:24:05.443 回答