Tho*_*mas 2 azure azure-cli azure-devops azure-pipelines azure-pipelines-yaml
当尝试在基于 ubuntu 的 Azure DevOps 管道中运行简单的 Azure CLI 任务时,我收到以下错误消息:
##[error]Script failed with error: Error: Unable to locate executable file:
'/home/vsts/work/_temp/azureclitaskscript1637831708745.bat'.
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.
Run Code Online (Sandbox Code Playgroud)
如果我正确地阅读了此内容,则未找到内联脚本,对吗?我在这里缺少什么?这是完整的 YAML:
trigger:
- main
- dev
pool:
vmImage: ubuntu-latest
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'My Subscription Name'
scriptType: 'batch'
scriptLocation: 'inlineScript'
inlineScript: 'az --version'
Run Code Online (Sandbox Code Playgroud)
您在 Linux 上运行您的任务,您不能batch在那里使用,您需要选择pscore或bash来代替,或者切换到windows-latestvmImage。
脚本类型*:选择要在代理上执行的脚本类型。任务支持四种类型:Batch / Shell / PowerShell / PowerShell Core 脚本,默认选择为空。在 Linux 代理上运行时选择 Shell/PowerShell Core 脚本,在 Windows 代理上运行时选择 Batch/PowerShell/PowerShell Core 脚本。PowerShell Core 脚本可以在跨平台代理(Linux、macOS 或 Windows)上运行
传递给参数的实际字符串可以在 task.json 中找到。看起来该任务没有对这些字段进行任何验证,从而导致了这种奇怪的错误情况。
"options": {
"ps": "PowerShell",
"pscore": "PowerShell Core",
"batch": "Batch",
"bash": "Shell"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8701 次 |
| 最近记录: |