Определение steps.pwsh

На pwsh этом шаге выполняется скрипт в PowerShell Core в Windows, macOS и Linux.

steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
  retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.

Определения, ссылающиеся на это определение: шаги

Свойства

pwsh Строка. Требуется в качестве первого свойства.
Встроенный скрипт PowerShell.

errorActionPreference Строка.
Если не указано иное, для действия ошибки по умолчанию используется значение stop. Дополнительные сведения см. в следующем разделе.

failOnStderr Строка.
Сбой задачи, если выходные данные отправлены в Stderr?

ignoreLASTEXITCODE Строка.
Проверьте окончательный код выхода скрипта, чтобы определить, выполнен ли шаг успешно?

workingDirectory Строка.
Запустите скрипт с помощью этого рабочего каталога.

condition Строка.
Оцените это выражение условия, чтобы определить, следует ли выполнять эту задачу.

continueOnErrorлогическое значение.
Продолжить работу даже при сбое?

displayName Строка.
Понятное имя задачи.

targettarget.
Среда, в которой выполняется эта задача.

enabledлогическое значение.
Выполнить эту задачу при выполнении задания?

env словарь строк.
Переменные для сопоставления со средой процесса.

name Строка.
Идентификатор шага. Допустимые значения: [-_A-Za-z0-9]*.

timeoutInMinutes Строка.
Время ожидания завершения этой задачи, прежде чем сервер завершит ее.

Примечание

Для конвейеров можно настроить время ожидания на уровне задания. Если интервал времени ожидания на уровне задания истекает до завершения шага, выполняемое задание (включая ваш шаг) завершается, даже если для шага настроен более длительный timeoutInMinutes интервал. Дополнительные сведения см. в разделе Время ожидания.

retryCountOnTaskFailure Строка.
Количество повторных попыток в случае сбоя задачи.

Комментарии

Ключевое слово pwsh — это ярлык для задачи PowerShell, если для этой задачи задано значение true. Задача запускает скрипт в PowerShell Core в Windows, macOS и Linux.

Дополнительные сведения об условиях и времени ожидания.

Каждый сеанс PowerShell длится только в течение задания, в котором он выполняется. Задачи, зависящие от начальной загрузки, должны находиться в том же задании, что и начальная загрузка.

Примеры

steps:
- pwsh: Write-Host Hello $($env:name)
  displayName: Say hello
  name: firstStep
  workingDirectory: $(build.sourcesDirectory)
  failOnStderr: true
  env:
    name: Microsoft

См. также раздел