嘗試在基于 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.
如果我沒看錯,就找不到行內腳本,對吧?我在這里錯過了什么?這是完整的 YAML:
trigger:
- main
- dev
pool:
vmImage: ubuntu-latest
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'My Subscription Name'
scriptType: 'batch'
scriptLocation: 'inlineScript'
inlineScript: 'az --version'
uj5u.com熱心網友回復:
你在 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)上運行
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzureCLIV2#parameters-of-the-task
傳遞給引數的實際字串可以在 task.json 中找到。看起來任務沒有對這些欄位進行任何驗證,導致這種奇怪的錯誤情況。
"options": {
"ps": "PowerShell",
"pscore": "PowerShell Core",
"batch": "Batch",
"bash": "Shell"
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/367681.html
