Я следую этому руководству , чтобы автоматизировать создание заметок о выпуске с помощью вики в Azure DevOps . Шаги очень просты c, и я полагаю, что не так много переменных может вызвать ошибку.
Когда я создаю релиз, он запускается и затем не удается выполнить задачу PowerShell. Вот что отображается в журнале с ошибкой:
[ошибка] Термин powershell.exe не распознается как имя командлета, функции, файла сценария или работоспособной программы. , Проверьте правильность написания имени или, если путь был указан, проверьте правильность пути и повторите попытку.
Я заменил имя своего агента на [myLocalAgent] в журнал
2020-03-10T08:46:58.0567080Z ##[debug]Evaluating condition for step: 'PowerShell Script'
2020-03-10T08:46:58.0567721Z ##[debug]Evaluating: succeeded()
2020-03-10T08:46:58.0567840Z ##[debug]Evaluating succeeded:
2020-03-10T08:46:58.0568071Z ##[debug]=> True
2020-03-10T08:46:58.0568346Z ##[debug]Result: True
2020-03-10T08:46:58.0568583Z ##[section]Starting: PowerShell Script
2020-03-10T08:46:58.0660872Z ==============================================================================
2020-03-10T08:46:58.0660963Z Task : PowerShell
2020-03-10T08:46:58.0661006Z Description : Run a PowerShell script on Linux, macOS, or Windows
2020-03-10T08:46:58.0661050Z Version : 2.165.0
2020-03-10T08:46:58.0661103Z Author : Microsoft Corporation
2020-03-10T08:46:58.0661147Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2020-03-10T08:46:58.0661190Z ==============================================================================
2020-03-10T08:46:59.2751397Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2020-03-10T08:46:59.4510283Z ##[debug]Entering C:\[myLocalAgent]\_work\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.165.0\powershell.ps1.
2020-03-10T08:46:59.4641263Z ##[debug]Loading resource strings from: C:\[myLocalAgent]\_work\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.165.0\task.json
2020-03-10T08:46:59.5013258Z ##[debug]Loaded 11 strings.
2020-03-10T08:46:59.5070774Z ##[debug]SYSTEM_CULTURE: 'en-US'
2020-03-10T08:46:59.5667676Z ##[debug]Loading resource strings from: C:\[myLocalAgent]\_work\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.165.0\Strings\resources.resjson\en-US\resources.resjson
2020-03-10T08:46:59.6018496Z ##[debug]Loaded 11 strings.
2020-03-10T08:46:59.6361663Z ##[debug]INPUT_ERRORACTIONPREFERENCE: 'stop'
2020-03-10T08:46:59.6401971Z ##[debug]INPUT_FAILONSTDERR: 'false'
2020-03-10T08:46:59.6440102Z ##[debug] Converted to bool: False
2020-03-10T08:46:59.6470870Z ##[debug]INPUT_IGNORELASTEXITCODE: 'false'
2020-03-10T08:46:59.6491840Z ##[debug] Converted to bool: False
2020-03-10T08:46:59.6521051Z ##[debug]INPUT_PWSH: 'false'
2020-03-10T08:46:59.6543374Z ##[debug] Converted to bool: False
2020-03-10T08:46:59.6572719Z ##[debug]INPUT_WORKINGDIRECTORY: 'C:\[myLocalAgent]\_work\r7\a'
2020-03-10T08:46:59.6748678Z ##[debug]Asserting container path exists: 'C:\[myLocalAgent]\_work\r7\a'
2020-03-10T08:46:59.6782331Z ##[debug]INPUT_TARGETTYPE: 'inline'
2020-03-10T08:46:59.6826977Z ##[debug]INPUT_SCRIPT: '# Get content of releasenotes
2020-03-10T08:46:59.6841501Z ##[debug]$content = [IO.File]::ReadAllText("C:\[myLocalAgent]\_work\r7\a\releasenotes.md")
2020-03-10T08:46:59.6855896Z ##[debug]# Get content of package.json for getting version value
2020-03-10T08:46:59.6870421Z ##[debug]$contentPackage = [IO.File]::ReadAllText("C:\[myLocalAgent]\_work\r7\a\package.json") | ConvertFrom-Json;
2020-03-10T08:46:59.6884843Z ##[debug]# Concat the URI
2020-03-10T08:46:59.6900257Z ##[debug]$uri = $env:WikiUri +$env:WikiPath + $($contentPackage.version)
2020-03-10T08:46:59.6916667Z ##[debug]# Convert to json for Wiki API
2020-03-10T08:46:59.6932043Z ##[debug]$data = @{content=$content;} | ConvertTo-Json;
2020-03-10T08:46:59.6947112Z ##[debug]# Set Request
2020-03-10T08:46:59.6960317Z ##[debug]$params = @{uri = "$($uri)";
2020-03-10T08:46:59.6973489Z ##[debug] Method = 'PUT';
2020-03-10T08:46:59.6986730Z ##[debug] Headers = @{Authorization = "Basic $($env:basicB64Token)" };
2020-03-10T08:46:59.7000064Z ##[debug] ContentType = "application/json";
2020-03-10T08:46:59.7013085Z ##[debug] Body = $data;
2020-03-10T08:46:59.7026111Z ##[debug]}
2020-03-10T08:46:59.7039918Z ##[debug]# Call
2020-03-10T08:46:59.7053974Z ##[debug]Invoke-WebRequest @params'
2020-03-10T08:46:59.7136093Z Generating script.
2020-03-10T08:46:59.7346195Z ##[debug]AGENT_VERSION: '2.154.3'
2020-03-10T08:46:59.7464794Z ##[debug]AGENT_TEMPDIRECTORY: 'C:\[myLocalAgent]\_work\_temp'
2020-03-10T08:46:59.7490309Z ##[debug]Asserting container path exists: 'C:\[myLocalAgent]\_work\_temp'
2020-03-10T08:46:59.8394063Z ##[debug]Leaving C:\[myLocalAgent]\_work\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.165.0\powershell.ps1.
2020-03-10T08:46:59.8447996Z ##[debug]Caught exception from task script.
2020-03-10T08:46:59.8484660Z ##[debug]Error record:
2020-03-10T08:46:59.9086805Z ##[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-03-10T08:46:59.9099083Z ##[debug] + CategoryInfo : ObjectNotFound: (powershell.exe:String) [], Comm andNotFoundException
2020-03-10T08:46:59.9111398Z ##[debug] + FullyQualifiedErrorId : CommandNotFoundException
2020-03-10T08:46:59.9124155Z ##[debug]
2020-03-10T08:46:59.9147270Z ##[debug]Script stack trace:
2020-03-10T08:46:59.9203751Z ##[debug]
2020-03-10T08:46:59.9225885Z ##[debug]Exception:
2020-03-10T08:46:59.9278832Z ##[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-03-10T08:46:59.9656113Z ##[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-03-10T08:46:59.9666068Z ##[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-03-10T08:46:59.9666747Z ##[debug]Processed: ##vso[task.complete result=Failed]
Я искал в Интернете, и есть ссылки на неправильное написание из-за пробелов в имени файла (без пробелов в именах моих файлов) или неправильного пути, на который ссылается (мой PowerShell рядный / генерироваться автоматически).
Буду признателен за любую помощь.
Заранее спасибо.