Udostępnij za pośrednictwem


steps.pwsh definition

Krok pwsh uruchamia skrypt w programie PowerShell Core w systemach Windows, macOS i 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.

Definicje odwołujące się do tej definicji: kroki

Właściwości

pwsh ciąg. Wymagane jako pierwsza właściwość.
wbudowany skrypt programu PowerShell.

errorActionPreference ciąg.
chyba że określono inaczej, preferencja akcji błędu jest domyślnie ustawiona na zatrzymanie wartości. Aby uzyskać więcej informacji, zobacz następującą sekcję.

failOnStderr ciąg.
Niepowodzenie zadania, jeśli dane wyjściowe są wysyłane do narzędzia Stderr?

ignoreLASTEXITCODE ciąg.
Sprawdź końcowy kod zakończenia skryptu, aby określić, czy krok zakończył się pomyślnie?

workingDirectory ciąg.
Uruchom skrypt przy użyciu tego katalogu roboczego.

condition ciąg.
Oceń to wyrażenie warunku, aby określić, czy należy uruchomić to zadanie.

continueOnError wartość logiczna.
kontynuować działanie nawet w przypadku awarii?

displayName ciąg.
czytelną dla człowieka nazwę zadania.

target docelowy.
środowisko, w którym ma zostać uruchomione to zadanie.

enabled wartość logiczna.
uruchomić to zadanie, gdy zadanie zostanie uruchomione?

env słownik ciągów.
Zmienne do mapowania na środowisko procesu.

name ciąg.
identyfikator kroku. Dopuszczalne wartości: [-_A-Za-z0-9]*.

timeoutInMinutes ciąg.
Czas oczekiwania na ukończenie tego zadania, zanim serwer go zabije.

Uwaga

Potoki można skonfigurować z limitem czasu na poziomie zadania. Jeśli interwał limitu czasu na poziomie zadania upłynie przed ukończeniem kroku, zadanie uruchomione (w tym krok) zostanie zakończone, nawet jeśli krok jest skonfigurowany z dłuższym interwałem timeoutInMinutes. Aby uzyskać więcej informacji, zobacz Limity czasu.

retryCountOnTaskFailure ciąg.
liczba ponownych prób w przypadku niepowodzenia zadania.

Uwagi

Słowo kluczowe pwsh to skrót do zadania programu PowerShell, gdy wartość pwsh tego zadania jest ustawiona na wartość true. Zadanie uruchamia skrypt w programie PowerShell Core w systemach Windows, macOS i Linux.

Dowiedz się więcej na temat warunków i limitów czasu .

Każda sesja programu PowerShell trwa tylko przez czas trwania zadania, w którym jest uruchamiana. Zadania zależne od bootstrap muszą znajdować się w tym samym zadaniu co bootstrap.

Przykłady

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

Zobacz też