steps.pwsh definition

Met de pwsh stap wordt een script uitgevoerd in PowerShell Core op Windows, macOS en 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.

Definities die naar deze definitie verwijzen: stappen

Eigenschappen

pwsh Tekenreeks. Vereist als eerste eigenschap.
Inline PowerShell-script.

errorActionPreference Tekenreeks.
Tenzij anders aangegeven, wordt de voorkeur voor de foutactie standaard ingesteld op de waardestop. Zie de volgende sectie voor meer informatie.

failOnStderr Tekenreeks.
Mislukt de taak als uitvoer naar Stderr wordt verzonden?

ignoreLASTEXITCODE Tekenreeks.
Controleer de laatste afsluitcode van het script om te bepalen of de stap is geslaagd?

workingDirectory Tekenreeks.
Start het script met deze werkmap.

condition Tekenreeks.
Evalueer deze voorwaardeexpressie om te bepalen of deze taak moet worden uitgevoerd.

continueOnErrorbooleaanse waarde.
Doorgaan met uitvoeren, zelfs bij een fout?

displayName Tekenreeks.
Door mensen leesbare naam voor de taak.

targetdoel.
Omgeving waarin deze taak moet worden uitgevoerd.

enabledbooleaanse waarde.
Deze taak uitvoeren wanneer de taak wordt uitgevoerd?

env tekenreekswoordenlijst.
Variabelen die moeten worden toegewezen aan de omgeving van het proces.

name Tekenreeks.
Id van de stap. Acceptabele waarden: [-_A-Za-z0-9]*.

timeoutInMinutes Tekenreeks.
Tijd om te wachten tot deze taak is voltooid voordat de server deze beëindigt.

Notitie

Pijplijnen kunnen worden geconfigureerd met een time-out op taakniveau. Als het time-outinterval op taakniveau is verstreken voordat de stap is voltooid, wordt de actieve taak (inclusief uw stap) beëindigd, zelfs als de stap is geconfigureerd met een langer timeoutInMinutes interval. Zie Time-outs voor meer informatie.

retryCountOnTaskFailure Tekenreeks.
Aantal nieuwe pogingen als de taak mislukt.

Opmerkingen

Het pwsh trefwoord is een snelkoppeling voor de PowerShell-taak wanneer de pwsh-waarde van die taak is ingesteld op true. Met de taak wordt een script uitgevoerd in PowerShell Core op Windows, macOS en Linux.

Meer informatie over voorwaarden en time-outs.

Elke PowerShell-sessie duurt alleen voor de duur van de taak waarin deze wordt uitgevoerd. Taken die afhankelijk zijn van wat is gebootstrapped, moeten zich in dezelfde taak bevinden als de bootstrap.

Voorbeelden

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

Zie ook