共用方式為


jobs.deployment definition

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

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: string # 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.
  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.
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: string # 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.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
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: string # Which parts of the workspace should be scorched before fetching.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs

參考此定義的定義: 作業

屬性

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

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

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

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

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

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

cancelTimeoutInMinutes 字串。
在強制終止作業之前,等候作業取消的時間。

variables變數
部署特定的變數。

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

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

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

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

usesjobs.job.uses
尚未參考此作業所需的任何資源。

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

services 字串字典。
要以服務容器身分執行的容器資源。

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

備註

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

範例

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