附加到 Azure Devops 上的 PATH?

Append to PATH on Azure Devops?

我需要附加到 Azure Devops 管道上的 PATH 环境变量。我已经尝试 运行 一个脚本来完成它,但它不起作用:

- script: |
echo '##vso[task.setvariable variable=PATH]${PATH}:some/path/'

这无法设置路径,还会导致后续脚本失败并显示以下内容:

##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

我需要做什么才能设置这个?

明白了,这是一个简单的语法错误

echo '##vso[task.setvariable variable=path]$(PATH):/dir/to/whatever'

我用了 {} 而不是 ()。

为此有一个特殊的日志记录命令:

echo '##vso[task.prependpath]some\path'

查看更多信息here