簡體   English   中英

Azure DevOps 發布管道 Azure CLI Powershell 任務找不到 Z2F2D399F0EA80FE47B3459

[英]Azure DevOps Release pipeline Azure CLI Powershell task can't find powershell

使用: Pool: Azure Pipelines · Agent: Hosted Agent

首次發布僅包含 2 個任務:

  1. Powershell 寫入“Hello world”的內聯腳本
  2. Azure 訂閱內聯腳本上的 Powershell 寫入“Hello world” 在此處輸入圖像描述

它工作得很好。

添加其他任務后:

  1. 執行我們的 PowerShell 腳本

  2. .4 部署到 Kubernetes 任務。 在此處輸入圖像描述

使用system.debug創建了 Release,它在第一個任務上失敗並出現錯誤:

2020-05-20T06:57:10.3710666Z ##[error]The term 'powershell.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Executing with system.debug gave this output:

2020-05-20T07:15:13.9833585Z ##[debug]Evaluating condition for step: 'Hello World'
2020-05-20T07:15:13.9843565Z ##[debug]Evaluating: succeeded()
2020-05-20T07:15:13.9844512Z ##[debug]Evaluating succeeded:
2020-05-20T07:15:13.9845838Z ##[debug]=> True
2020-05-20T07:15:13.9846542Z ##[debug]Result: True
2020-05-20T07:15:13.9847415Z ##[section]Starting: Hello World
2020-05-20T07:15:14.0314856Z ==============================================================================
2020-05-20T07:15:14.0315650Z Task         : PowerShell
2020-05-20T07:15:14.0317519Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2020-05-20T07:15:14.0317953Z Version      : 2.169.0
2020-05-20T07:15:14.0318548Z Author       : Microsoft Corporation
2020-05-20T07:15:14.0319259Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2020-05-20T07:15:14.0319792Z ==============================================================================
2020-05-20T07:15:15.8622679Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2020-05-20T07:15:16.0680294Z ##[debug]Entering D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.169.0\powershell.ps1.
2020-05-20T07:15:16.0782094Z ##[debug]Loading resource strings from: D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.169.0\task.json
2020-05-20T07:15:16.1340432Z ##[debug]Loaded 11 strings.
2020-05-20T07:15:16.1343861Z ##[debug]SYSTEM_CULTURE: 'en-US'
2020-05-20T07:15:16.1345219Z ##[debug]Loading resource strings from: D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.169.0\Strings\resources.resjson\en-US\resources.resjson
2020-05-20T07:15:16.1597086Z ##[debug]Loaded 11 strings.
2020-05-20T07:15:16.1959084Z ##[debug]INPUT_ERRORACTIONPREFERENCE: 'stop'
2020-05-20T07:15:16.2027000Z ##[debug]INPUT_FAILONSTDERR: 'false'
2020-05-20T07:15:16.2028272Z ##[debug] Converted to bool: False
2020-05-20T07:15:16.2041964Z ##[debug]INPUT_IGNORELASTEXITCODE: 'false'
2020-05-20T07:15:16.2056755Z ##[debug] Converted to bool: False
2020-05-20T07:15:16.2081737Z ##[debug]INPUT_PWSH: 'false'
2020-05-20T07:15:16.2100091Z ##[debug] Converted to bool: False
2020-05-20T07:15:16.2122826Z ##[debug]INPUT_WORKINGDIRECTORY: 'D:\a\r1\a'
2020-05-20T07:15:16.2247526Z ##[debug]Asserting container path exists: 'D:\a\r1\a'
2020-05-20T07:15:16.2273044Z ##[debug]INPUT_TARGETTYPE: 'inline'
2020-05-20T07:15:16.2307533Z ##[debug]INPUT_SCRIPT: '# Write your PowerShell commands here.
2020-05-20T07:15:16.2320023Z ##[debug]
2020-05-20T07:15:16.2331579Z ##[debug]Write-Host "Hello World"'
2020-05-20T07:15:16.2375904Z Generating script.
2020-05-20T07:15:16.2515233Z ##[debug]AGENT_VERSION: '2.168.2'
2020-05-20T07:15:16.2594226Z ##[debug]AGENT_TEMPDIRECTORY: 'D:\a\_temp'
2020-05-20T07:15:16.2614777Z ##[debug]Asserting container path exists: 'D:\a\_temp'
2020-05-20T07:15:27.6754436Z ##[debug]Leaving D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.169.0\powershell.ps1.
2020-05-20T07:15:27.9496049Z ##[debug]Caught exception from task script.
2020-05-20T07:15:27.9529115Z ##[debug]Error record:
2020-05-20T07:15:28.0379597Z ##[debug]The term 'powershell.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2020-05-20T07:15:28.0395647Z ##[debug]    + CategoryInfo          : ObjectNotFound: (powershell.exe:String) [], CommandNotFoundException
2020-05-20T07:15:28.0402331Z ##[debug]    + FullyQualifiedErrorId : CommandNotFoundException
2020-05-20T07:15:28.0412871Z ##[debug] 
2020-05-20T07:15:28.0433105Z ##[debug]Script stack trace:
2020-05-20T07:15:28.0479363Z ##[debug]
2020-05-20T07:15:28.1031586Z ##[debug]Exception:
2020-05-20T07:15:28.1168338Z ##[debug]System.Management.Automation.CommandNotFoundException: The term 'powershell.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2020-05-20T07:15:28.1325804Z ##[error]The term 'powershell.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2020-05-20T07:15:28.1338779Z ##[debug]Processed: ##vso[task.logissue type=error]The term 'powershell.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2020-05-20T07:15:28.1347561Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-05-20T07:15:28.2164053Z ##[section]Finishing: Hello World

筆記。

不要在 Azure DevOps 管道中命名您的變量path ,因為它會重寫環境變量PATH 重命名我的變量后,它再次工作並且能夠找到所有工具。 在 MS 文檔中沒有提到它,所以我為他們創建了一張票。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM