definición steps.pwsh

El pwsh paso ejecuta un script en PowerShell Core en Windows, macOS y 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.

Definiciones que hacen referencia a esta definición: pasos

Propiedades

pwsh Cadena. Obligatorio como primera propiedad.
Script de PowerShell insertado.

errorActionPreference Cadena.
A menos que se especifique lo contrario, la preferencia de acción de error tiene como valor predeterminado detener el valor. Para obtener más información, vea la sección siguiente.

failOnStderr Cadena.
¿Produce un error en la tarea si la salida se envía a Stderr?

ignoreLASTEXITCODE Cadena.
Compruebe el código de salida final del script para determinar si el paso se realizó correctamente?

workingDirectory Cadena.
Inicie el script con este directorio de trabajo.

condition Cadena.
Evalúe esta expresión de condición para determinar si se va a ejecutar esta tarea.

continueOnErrorbooleano.
¿Sigue ejecutándose incluso en caso de error?

displayName Cadena.
Nombre legible para la tarea.

targettarget.
Entorno en el que se va a ejecutar esta tarea.

enabledbooleano.
¿Ejecuta esta tarea cuando se ejecuta el trabajo?

env diccionario de cadenas.
Variables que se van a asignar al entorno del proceso.

name Cadena.
Identificador del paso. Valores aceptables: [-_A-Za-z0-9]*.

timeoutInMinutes Cadena.
Tiempo de espera para que esta tarea se complete antes de que el servidor la mate.

Nota

Las canalizaciones se pueden configurar con un tiempo de espera de nivel de trabajo. Si el intervalo de tiempo de espera de nivel de trabajo transcurre antes de que se complete el paso, se finaliza el trabajo en ejecución (incluido el paso), incluso si el paso está configurado con un intervalo más largo timeoutInMinutes . Para obtener más información, consulte Tiempos de espera.

retryCountOnTaskFailure Cadena.
Número de reintentos si se produce un error en la tarea.

Comentarios

La palabra clave pwsh es un acceso directo para la tarea de PowerShell cuando el valor pwsh de esa tarea se establece en true. La tarea ejecuta un script en PowerShell Core en Windows, macOS y Linux.

Obtenga más información sobre las condiciones y los tiempos de espera.

Cada sesión de PowerShell solo dura el tiempo que dura el trabajo en el que se ejecuta. Las tareas que dependen de lo que se ha arrancado deben estar en el mismo trabajo que el arranque.

Ejemplos

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

Vea también