Condividi tramite


steps.task definition

Un passaggio task esegue un'attività.

Tutte le attività supportano il set seguente di proprietà comuni.

steps:
- task: string # Required as first property. Name of the task to run.
  inputs: # Inputs for the task.
    string: string # Name/value pairs
  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:
- task: string # Required as first property. Name of the task to run.
  inputs: # Inputs for the task.
    string: string # Name/value pairs
  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.

Definizioni che fanno riferimento a questa definizione: passaggi

Proprietà

task stringa. Obbligatorio come prima proprietà.
Nome dell'attività da eseguire.

inputs dizionario di stringhe.
input per l'attività.

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

continueOnError booleano .
Continuare l'esecuzione anche in caso di errore?

displayName stringa.
nome leggibile per l'attività.

target destinazione.
Ambiente in cui eseguire questa attività.

enabled booleano .
Esegui questa attività quando viene eseguito il processo?

env dizionario di stringhe.
Variabili di cui eseguire il mapping nell'ambiente del processo.

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

timeoutInMinutes stringa.
Tempo di attesa per il completamento dell'attività prima che il server lo uccida. Ad esempio, per configurare un timeout di 10 minuti, usare timeoutInMinutes: 10.

Nota

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

retryCountOnTaskFailure stringa.
Numero di tentativi in caso di errore dell'attività. In Azure DevOps Server 2022, 2022.1 e 2022.2 i tentativi sono supportati solo nei processi dell'agente. Per altre informazioni, vedere aggiornamento del servizio Azure DevOps 16 novembre 2021 - Tentativi automatici per un'attività e aggiornamento del servizio Azure DevOps 14 giugno 2025 - Tentativi per le attività del server.

Osservazioni:

Attività sono i blocchi predefiniti di una pipeline. È disponibile un catalogo di attività tra cui scegliere.

Se non si specifica una modalità di comando, è possibile abbreviare la struttura target in:

- task:
  target: string  # container name or the word 'host'

Proprietà comuni delle attività

Tutte le attività supportano un set di proprietà comuni oltre a name e inputs. Per un elenco delle proprietà comuni delle attività, vedere la sezione precedente Proprietà. Per altre informazioni sulla configurazione di queste proprietà, vedere Opzioni di controllo attività e variabili di ambiente dell'attività.

Altre informazioni sulle condizioni di , sui timeout e sulle destinazioni dei passaggi .

Esempi

steps:
- task: VSBuild@1
  displayName: Build
  timeoutInMinutes: 120
  inputs:
    solution: '**\*.sln'

Vedere anche