Compartir a través de


definición steps.pwsh

El paso pwsh 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.

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. Consulte la sección siguiente para obtener más información.

failOnStderr cadena.
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.
Iniciar el script con este directorio de trabajo.

condition cadena.
Evaluar esta expresión de condición para determinar si se debe ejecutar esta tarea.

continueOnError booleano .
Continuar ejecutándose incluso en caso de error?

displayName cadena.
nombre legible para la tarea.

target de destino .
entorno en el que se va a ejecutar esta tarea.

enabled booleano .
Ejecutar 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 se complete esta tarea antes de que el servidor lo mate.

Nota:

Las canalizaciones se pueden configurar con un tiempo de espera de nivel de trabajo. Si el intervalo de tiempo de espera del 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 de timeoutInMinutes más largo. Para obtener más información, vea Tiempos de espera.

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

Observaciones

La palabra clave pwsh es un acceso directo para el tarea de PowerShell de cuando el valor de 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 condiciones y tiempos de espera.

Cada sesión de PowerShell dura solo durante 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

Consulte también

  • tarea de PowerShell
  • Obtenga más información sobre las condiciones de y tiempos de espera