Этап PowerShell для конвейера Jenkins не выполнен из-за «PowerShell не найден» - PullRequest
0 голосов
/ 30 мая 2018

У меня есть сервер Jenkins под управлением v2.107.3 и узел агента Windows.Простой тестовый конвейер powershell не выполняется, потому что он не может найти «powershell».

Вот мой тестовый конвейер:

pipeline {
    stages {
        stage('test') {
            steps {
                powershell(script:'Write-Output Hello')
            }
        }
    }
}

И ответ агента всегда:

C:\Jenkins\workspace\test_ps_remoting@tmp\durable-ccca47a5\powershellWrapper.ps1 : The term 'powershell' 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.
At C:\Jenkins\workspace\test_ps_remoting@tmp\durable-ccca47a5\powershellHelper.ps1:54 char:9
+     & { & $MainScript | Out-FileNoBom -Writer $OutputWriter } *>&1 |  ...
+         ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (powershell:String) [powershellWrapper.ps1], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,powershellWrapper.ps1

Мне удалось получить копию файлов в @tmp по мере их запуска, и если я выполняю шаги вручную, похоже, все работает нормально:

. .\powershellHelper.ps1
Execute-AndWriteOutput -MainScript .\powershellWrapper.ps1 -OutputFile out.txt -LogFile log.txt -ResultFile result.txt

Создает файлыожидается, с "результатом" 0 и журналом Hello.

1 Ответ

0 голосов
/ 30 мая 2018

Исходя из вашей ошибки, процесс, вероятно, не может найти исполняемый файл powershell, то есть он

  1. Не полностью исправлен
  2. Нет в переменной среды PATH

Если вы исправите один из них, ваша проблема должна быть решена.

...