且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Azure devops中的Docker任务将不接受"$(pwd)"作为变量

更新时间:2023-10-17 18:19:52

您正在尝试引用名为 pwd 的变量.没有没有这样的预定义变量在Azure Pipelines中.

You're trying to reference a variable named pwd. There is no such predefined variable in Azure Pipelines.

您提到这在您的本地计算机上有效,但这不是因为定义了 pwd 变量.(实际上,您的环境中可能没有 一个 pwd 环境变量.)这是因为 $(pwd)

You mention that this works in your local machine, but that's not because there's a pwd variable defined. (In fact, there's probably not a pwd environment variable in your environment.) That's because $(pwd) is POSIX command substitution. It's actually executing the pwd command.

此POSIX Shell语法在Azure Pipelines配置中不起作用.

This POSIX shell syntax will not work in Azure Pipelines configuration.

相反,请使用 Azure中的一种管道变量.

例如,如果要映射源目录,可以将"volumes"字段设置为:

For example, if you want to map the sources directory, you can set the volumes field to:

$(Build.SourcesDirectory):/src

或映射源和二进制文件:

Or map source and binaries:

 $(Build.SourcesDirectory):/src
 $(Build.BinariesDirectory):/build