将 Azure 发布工件默认目录配置为 C(使用“1”参数调用 "GetHostByName":"No such host is known")

Configure Azure release artifacts default directory to C (calling "GetHostByName" with "1" argument(s): "No such host is known")

我有两个 Devops Azure 发布阶段(DEV 和 TT)。 Dev 能够从构建源 CI 管道中检索工件并复制到 C 驱动器(看起来没问题),因为 TT 复制到 D 驱动器,我无法在构建服务器上找到路径,如 D:\a\r1\a...并抛出如下异常。

[错误]使用“1”个参数调用“GetHostByName”时出现异常:“不知道这样的主机”

如何将 TT 的默认复制驱动器设置为 C?

更新

如果您看不到在构建代理上创建的任何文件夹。那么一种可能性是,两个阶段可能不会 运行 在同一个构建代理中。请仔细检查此信息。

如果您仍然遇到类似的错误,请设置 debug=true 并在此处共享相关日志以进行故障排除。

OP 验证问题已解决: 对 Dev 和 TT 使用不同的发布代理。将两个代理都更改为单个代理。


根据你的错误信息,猜测你正在使用主机代理。

这与您使用的驱动器无关。

Avoid hard-coded references

When you use a Microsoft-hosted agent, always use variables to refer to the build environment and agent resources. For example, don't hard-code the drive letter or folder that contains the repository. The precise layout of the hosted agents is subject to change without warning.

Source Link


如果您使用的是自托管代理。它与您的默认代理安装路径有关。有一个相关的预定义变量

Agent.ReleaseDirectory

The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as System.ArtifactsDirectory and System.DefaultWorkingDirectory.

更多详情请参考Agent variables

如果要更改路径,需要确保代理安装在 C:\ 而不是 D:\ 下。此外,您还可以根据需要选择在发布管道中使用Copy Files task将文件从源文件夹复制到目标文件夹。