steps.pwsh-definition

Steget pwsh kör ett skript i PowerShell Core i Windows, macOS och 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.

Definitioner som refererar till den här definitionen: steg

Egenskaper

pwsh Sträng. Krävs som första egenskap.
Infogat PowerShell-skript.

errorActionPreference Sträng.
Om inget annat anges används värdet för standardinställningen för felåtgärden. Mer information finns i följande avsnitt.

failOnStderr Sträng.
Misslyckas uppgiften om utdata skickas till Stderr?

ignoreLASTEXITCODE Sträng.
Kontrollera skriptets slutliga slutkod för att avgöra om steget lyckades?

workingDirectory Sträng.
Starta skriptet med den här arbetskatalogen.

condition Sträng.
Utvärdera det här villkorsuttrycket för att avgöra om den här aktiviteten ska köras.

continueOnErrorbooleskt värde.
Vill du fortsätta köra även vid fel?

displayName Sträng.
Läsbart namn för uppgiften.

targetmål.
Miljö där den här uppgiften ska köras.

enabledbooleskt värde.
Kör du den här uppgiften när jobbet körs?

env strängordlista.
Variabler som ska mappas till processens miljö.

name Sträng.
ID för steget. Godtagbara värden: [-_A-Za-z0-9]*.

timeoutInMinutes Sträng.
Det är dags att vänta tills den här uppgiften har slutförts innan servern avlöser den.

Anteckning

Pipelines kan konfigureras med en tidsgräns på jobbnivå. Om tidsgränsintervallet på jobbnivå förflutit innan steget slutförs avslutas det pågående jobbet (inklusive steget), även om steget har konfigurerats med ett längre timeoutInMinutes intervall. Mer information finns i Timeouter.

retryCountOnTaskFailure Sträng.
Antal återförsök om aktiviteten misslyckas.

Kommentarer

Nyckelordet pwsh är en genväg för PowerShell-aktiviteten när aktivitetens pwsh-värde är inställt på true. Uppgiften kör ett skript i PowerShell Core i Windows, macOS och Linux.

Läs mer om villkor och tidsgränser.

Varje PowerShell-session varar endast under hela det jobb där den körs. Uppgifter som är beroende av vad som har bootstrapped måste ha samma jobb som bootstrap.

Exempel

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

Se även