steps.pwsh definition

Il pwsh passaggio esegue uno script in PowerShell Core in Windows, macOS e 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.

Definizioni che fanno riferimento a questa definizione: passaggi

Proprietà

pwsh Stringa. Obbligatorio come prima proprietà.
Script di PowerShell inline.

errorActionPreference Stringa.
A meno che non sia specificato diversamente, la preferenza per l'azione di errore è predefinita per l'arresto del valore. Per altre informazioni, vedere la sezione successiva.

failOnStderr Stringa.
Errore dell'attività se l'output viene inviato a Stderr?

ignoreLASTEXITCODE Stringa.
Controllare il codice di uscita finale dello script per determinare se il passaggio ha avuto esito positivo?

workingDirectory Stringa.
Avviare lo script con questa directory di lavoro.

condition Stringa.
Valutare questa espressione di condizione per determinare se eseguire questa attività.

continueOnErrorboolean.
Continuare l'esecuzione anche in caso di errore?

displayName Stringa.
Nome leggibile per l'attività.

targetdestinazione.
Ambiente in cui eseguire questa attività.

enabledboolean.
Eseguire questa attività quando viene eseguito il processo?

env dizionario stringa.
Variabili da mappare nell'ambiente del processo.

name Stringa.
ID del passaggio. Valori accettabili: [-_A-Za-z0-9]*.

timeoutInMinutes Stringa.
Tempo per attendere il completamento di questa attività prima che il server lo uccide.

Nota

Le pipeline possono essere configurate con un timeout a livello di processo. Se l'intervallo di timeout a livello di processo viene trascorso prima del completamento del passaggio, il processo in esecuzione (incluso il passaggio) viene terminato, anche se il passaggio è configurato con un intervallo più lungo timeoutInMinutes . Per altre informazioni, vedere Timeout.

retryCountOnTaskFailure Stringa.
Numero di tentativi se l'attività ha esito negativo.

Commenti

La pwsh parola chiave è un collegamento per l'attività di PowerShell quando il valore pwsh dell'attività dell'attività è impostato su true. L'attività esegue uno script in PowerShell Core in Windows, macOS e Linux.

Altre informazioni sulle condizioni e sui timeout.

Ogni sessione di PowerShell dura solo per la durata del processo in cui viene eseguita. Le attività che dipendono da ciò che è stato avviato devono trovarsi nello stesso processo del bootstrap.

Esempi

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

Vedere anche