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.
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
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.
  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 字符串 |字符串列表。
在此作业之前必须完成的任何作业。

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,请参阅 限制作业授权范围“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