Partager via


définition steps.pwsh

L’étape pwsh exécute un script dans PowerShell Core sur Windows, macOS et 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.

Définitions qui font référence à cette définition : étapes

Propriétés

chaîne pwsh. Obligatoire en tant que première propriété.
script PowerShell inline.

chaîne errorActionPreference.
Sauf indication contraire, la préférence d’action d’erreur est définie par défaut sur l’arrêt de la valeur. Pour plus d’informations, consultez la section suivante.

chaîne failOnStderr.
Échec de la tâche si la sortie est envoyée à Stderr ?

chaîne ignoreLASTEXITCODE.
Vérifier le code de sortie final du script pour déterminer si l’étape a réussi ?

chaîne workingDirectory.
Démarrer le script avec ce répertoire de travail.

chaîne condition.
Évaluer cette expression de condition pour déterminer s’il faut exécuter cette tâche.

continueOnError booléen .
Continuer à s’exécuter même en cas d’échec ?

chaîne displayName.
nom lisible par l’homme pour la tâche.

target cible .
Environnement dans lequel exécuter cette tâche.

enabled booléen .
Exécuter cette tâche lors de l’exécution du travail ?

env dictionnaire de chaînes.
Variables à mapper dans l’environnement du processus.

chaîne name.
ID de l’étape. Valeurs acceptables : [-_A-Za-z0-9]*.

chaîne timeoutInMinutes.
Délai d’attente de cette tâche avant que le serveur ne le tue.

Remarque

Les pipelines peuvent être configurés avec un délai d’expiration au niveau du travail. Si l’intervalle de délai d’expiration du niveau du travail s’écoule avant la fin de votre étape, le travail en cours d’exécution (y compris votre étape) est arrêté, même si l’étape est configurée avec un intervalle de timeoutInMinutes plus long. Pour plus d’informations, consultez délais d’expiration.

chaîne retryCountOnTaskFailure.
Nombre de nouvelles tentatives en cas d’échec de la tâche.

Remarques

Le mot clé pwsh est un raccourci pour la tâche PowerShell lorsque la valeur pwsh de cette tâche est définie sur true. La tâche exécute un script dans PowerShell Core sur Windows, macOS et Linux.

En savoir plus sur les conditions et les délais d’expiration .

Chaque session PowerShell dure uniquement pendant la durée du travail dans lequel elle s’exécute. Les tâches qui dépendent de ce qui a été démarré doivent se trouver dans le même travail que le bootstrap.

Exemples

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

Voir aussi

  • tâche PowerShell
  • En savoir plus sur les conditions et les délais d’expiration de