共用方式為


jobs.job definition

jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: outputs | resources | all # Which parts of the workspace should be scorched before fetching.
  uses: # Any resources required by this job that are not already referenced.
    repositories: [ string ] # Repository references.
    pools: [ string ] # Pool references.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
  templateContext: # Job related information passed from a pipeline when extending a template.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: outputs | resources | all # Which parts of the workspace should be scorched before fetching.
  uses: # Any resources required by this job that are not already referenced.
    repositories: [ string ] # Repository references.
    pools: [ string ] # Pool references.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: outputs | resources | all # Which parts of the workspace should be scorched before fetching.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.

參考此定義的定義:作業

性能

job 字串。 做為第一個屬性的必要屬性。
作業的標識碼。 可接受的值:有效名稱可能只包含英數位元和 『_』 ,且開頭不一定是數位。

displayName 字串。
作業的人類可讀取名稱。

dependsOn 字串 |字串清單。
必須在此作業之前完成的任何作業。

condition 字串。
評估此條件表示式,以判斷是否要執行此作業。

continueOnError 字串。
即使在失敗時仍繼續執行?

timeoutInMinutes 字串。
等候此作業在伺服器終止之前完成的時間。

cancelTimeoutInMinutes 字串。
等候作業取消的時間,然後強制終止作業。

variables 變數
作業特定的變數。

strategy jobs.job.strategy
此作業的執行策略。

pool 集區
執行此作業的集區。

container jobs.job.container
容器資源名稱。

services 字串字典。
容器資源以服務容器的形式執行。

workspace 工作區
代理程式上的工作區選項。 如需工作區的詳細資訊,包括清除選項,請參閱 作業中的 工作區 主題。

uses jobs.job.uses
尚未參考此作業所需的任何資源。 如需 uses的詳細資訊,請參閱 將作業授權範圍限制為參考的 Azure DevOps 存放庫

steps 步驟
要執行的步驟清單。

templateContext templateContext。
擴充範本時從管線傳遞的作業相關信息。 如需詳細資訊,請參閱備註。 如需 templateContext的詳細資訊,請參閱 擴充 YAML 管線範本現在可以傳遞階段、作業和部署的內容資訊,範本 - 使用 templateContext 將屬性傳遞至範本

備註

默認 timeoutInMinutes 設定為 60 分鐘。 如需詳細資訊,請參閱 逾時

作業可以有條件地執行 ,而且可能 相依於先前的作業

備註

如果您只有一個階段和一個作業,您可以使用 單一作業語法,以較短的方式描述要執行的步驟。

範例

jobs:
- job: MyJob
  displayName: My First Job
  continueOnError: true
  workspace:
    clean: outputs
  steps:
  - script: echo My first job

另請參閱