共用方式為


jobs.deployment 定義

部署作業 是特殊類型的作業。 這是針對環境循序執行的步驟集合。

jobs:
- deployment: string # Required as first property. Name of the deployment job, A-Z, a-z, 0-9, and underscore. The word deploy is a keyword and is unsupported as the deployment name.
  displayName: string # Human-readable name for the deployment.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this deployment.
  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 ] # Deployment-specific variables.
  pool: string | pool # Pool where this job will run.
  environment: string | environment # Target environment name and optionally a resource name to record the deployment history; format: environment-name.resource-name.
  strategy: strategy # Execution strategy for this deployment.
  workspace: # Workspace options on the agent.
    clean: outputs | resources | all # What to clean up before the job runs.
  uses: # Any resources required by this job that are not already referenced.
    repositories: [ string ] # Repository references.
    pools: [ string ] # Pool references.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  templateContext: # Deployment related information passed from a pipeline when extending a template.

參考此定義的定義:作業

性能

deployment 字串。 做為第一個屬性的必要屬性。
部署作業的名稱、A-Z、a-z、0-9 和底線。 deploy 這個字是關鍵詞,不支援做為部署名稱。

displayName 字串。
人類可讀取的部署名稱。

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

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

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

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

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

variables 變數
部署特定變數。

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

environment jobs.deployment.environment
目標環境名稱和選擇性的資源名稱來記錄部署歷程記錄;format:environment-name.resource-name。

strategy jobs.deployment.strategy
此部署的執行策略。

workspace 工作區
代理程式上的工作區選項。

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

uses jobs.job.uses
指定此作業所需的資源,這些資源尚未在管線中其他地方參考,例如 簽出 步驟或 存放庫資源。 如需 的詳細資訊 uses,請參閱 限制預先宣告資源的作業授權範圍「使用」語句

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

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

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

備註

在YAML管線中,管線小組建議您將部署步驟放在部署作業中。

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

範例

jobs:
  # track deployments on the environment
- deployment: DeployWeb
  displayName: deploy Web App
  pool:
    vmImage: ubuntu-latest
  # creates an environment if it doesn't exist
  environment: 'smarthotel-dev'
  strategy:
    # default deployment strategy, more coming...
    runOnce:
      deploy:
        steps:
        - script: echo my first deployment