步骤 task
运行任务。
所有任务都支持以下一组通用属性。
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.
引用此定义的定义:步骤
性能
task
字符串。 必需为第一个属性。
要运行的任务的名称。
inputs
字符串字典。
任务的输入。
condition
字符串。
计算此条件表达式以确定是否运行此任务。
continueOnError
布尔。
即使在失败时继续运行?
displayName
字符串。
任务的人可读名称。
target
目标。
运行此任务的环境。
enabled
布尔。
作业运行时运行此任务?
env
字符串字典。
变量以映射到进程的环境。
name
字符串。
步骤的 ID。 可接受的值:[-_A-Za-z0-9]*。
timeoutInMinutes
字符串。
等待此任务在服务器终止之前完成的时间。 例如,若要配置 10 分钟的超时,请使用 timeoutInMinutes: 10
。
注释
管道可配置为作业级别超时。 如果作业级别超时间隔在步骤完成之前已过,则运行作业(包括步骤)将终止,即使该步骤配置了更长的 timeoutInMinutes
间隔。 有关详细信息,请参阅 超时。
retryCountOnTaskFailure
字符串。
如果任务失败, 重试次数。 在 Azure DevOps Server 2022、2022.1 和 2022.2 上,仅代理作业支持重试。 有关详细信息,请参阅 2021 年 11 月 16 日 Azure DevOps 服务更新 - 自动重试任务 和 Azure DevOps 服务更新 2025 年 6 月 14 日 - 服务器任务的重试。
注解
如果未指定命令模式,则可以将 target
结构缩短为:
- task:
target: string # container name or the word 'host'
常见任务属性
除和inputs
外,所有任务都支持一组通用属性name
。 有关常见任务属性的列表,请参阅前面的 “属性” 部分。 有关配置这些属性的详细信息,请参阅 任务控制选项 和 任务环境变量。
例子
steps:
- task: VSBuild@1
displayName: Build
timeoutInMinutes: 120
inputs:
solution: '**\*.sln'