steps.task definition

步驟 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.
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.
  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 字串。
工作的人類可讀取名稱。

targettarget
執行這項工作的環境。

enabled布林值
當作業執行時,請執行這項工作?

env 字串字典。
要對應至進程環境的變數。

name 字串。
步驟的識別碼。 可接受的值:[-_A-Za-z0-9]*。

timeoutInMinutes 字串。
等候此工作在伺服器終止之前完成的時間。 例如,若要設定 10 分鐘的逾時,請使用 timeoutInMinutes: 10

注意

管線可以設定為作業層級逾時。 如果作業層級逾時間隔在步驟完成之前經過,執行中的作業 (包括步驟) 終止,即使步驟設定了較長 timeoutInMinutes 的間隔也一樣。 如需詳細資訊,請參閱 逾時

retryCountOnTaskFailure 字串。
如果工作失敗,重試次數。

備註

工作 是管線的建置組塊。 有一個可供選擇 的工作目錄

如果您未指定命令模式,您可以將 結構縮短 target 為:

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

一般工作屬性

除了 和 inputs 之外 name ,所有工作都支援一組通用屬性。 如需一般工作屬性的清單,請參閱上述 屬性 一節。 如需設定這些屬性的詳細資訊,請參閱 工作控制選項工作環境變數

深入瞭解 條件逾時步驟目標

範例

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

另請參閱