Поделиться через


Определение job.job

Задание — это коллекция шагов, выполняемых агентом или на сервере .

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 job.job.strategy.
стратегии выполнения для этого задания.

pool пула.
пул, где будет выполняться это задание.

container job.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

См. также