Udostępnij za pośrednictwem


jobs.job definition

Zadanie to zbiór kroków uruchamianych przez agenta lub na serwerze .

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.

Definicje odwołujące się do tej definicji: zadania

Właściwości

job ciąg. Wymagane jako pierwsza właściwość.
identyfikator zadania. Dopuszczalne wartości: Prawidłowe nazwy mogą zawierać tylko znaki alfanumeryczne i '_' i mogą nie zaczynać się od liczby.

displayName ciąg.
czytelną dla człowieka nazwę zadania.

ciąg dependsOn | lista ciągów.
Wszystkie zadania, które muszą zostać ukończone przed tym.

condition ciąg.
Oceń to wyrażenie warunku, aby określić, czy należy uruchomić to zadanie.

continueOnError ciąg.
kontynuować działanie nawet w przypadku awarii?

timeoutInMinutes ciąg.
Czas oczekiwania na ukończenie tego zadania, zanim serwer go zabije.

cancelTimeoutInMinutes ciąg.
Czas oczekiwania na anulowanie zadania przed wymuszonym zakończeniem.

variables zmiennych.
zmienne specyficzne dla zadania.

strategy jobs.job.strategy.
strategia wykonywania dla tego zadania.

pool puli.
pulę, w której zostanie uruchomione to zadanie.

container jobs.job.container.
nazwa zasobu kontenera.

services słownik ciągów.
zasoby kontenera do uruchamiania jako kontenera usługi.

workspace obszaru roboczego.
opcje obszaru roboczego na agencie. Aby uzyskać więcej informacji na temat obszarów roboczych, w tym opcji czyszczenia, zobacz temat workspace w temacie Jobs.

uses jobs.job.uses.
Wszystkie zasoby wymagane przez to zadanie, do których jeszcze nie odwołuje się odwołanie. Aby uzyskać więcej informacji na temat uses, zobacz Limit zakresu autoryzacji zadań do odwołań do repozytoriów usługi Azure DevOps.

steps kroki.
listę kroków do uruchomienia.

templateContext szablonContext.
informacje dotyczące zadania przekazywane z potoku podczas rozszerzania szablonu. Zobacz uwagi, aby uzyskać więcej informacji. Aby uzyskać więcej informacji na temat templateContext, zobacz szablony rozszerzonych potoków YAML można teraz przekazywać informacje kontekstowe dla etapów, zadań i wdrożeń i szablonów — użyj szablonuContext, aby przekazać właściwości do szablonów.

Uwagi

Domyślny timeoutInMinutes jest ustawiony na 60 minut. Aby uzyskać więcej informacji, zobacz Limity czasu.

Zadania mogą być uruchamiane warunkowo i mogą zależeć od wcześniejszych zadań.

Uwaga

Jeśli masz tylko jeden etap i jedno zadanie, możesz użyć składni pojedynczego zadania jako krótszy sposób opisania kroków do uruchomienia.

Aby uzyskać więcej informacji na temat templateContext, zobacz szablony rozszerzonych potoków YAML można teraz przekazywać informacje kontekstowe dla etapów, zadań i wdrożeń i szablonów — użyj szablonuContext, aby przekazać właściwości do szablonów.

Przykłady

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

Zobacz też