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: 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.
  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: 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.
  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: string # 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.
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: string # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # 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.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # 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.
Czytelna dla człowieka nazwa zadania.

dependsOn ciąg | 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.
Czy 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 jego zakończeniem.

variableszmienne.
Zmienne specyficzne dla zadania.

strategyjobs.job.strategy.
Strategia wykonywania dla tego zadania.

poolpula.
Pula, w której zostanie uruchomione to zadanie.

containerjobs.job.container.
Nazwa zasobu kontenera.

services słownik ciągów.
Zasoby kontenera do uruchomienia jako kontener usługi.

workspaceobszar roboczy.
Opcje obszaru roboczego w agencie. Aby uzyskać więcej informacji na temat obszarów roboczych, w tym opcji czyszczenia, zobacz temat obszaru roboczego w temacie Zadania.

usesjobs.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 usesusługi , zobacz Ograniczanie zakresu autoryzacji zadań do przywoływanych repozytoriów usługi Azure DevOps.

stepskroków.
Lista kroków do uruchomienia.

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

Uwagi

Wartość domyślna timeoutInMinutes to 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ótszego sposobu opisania kroków do uruchomienia.

Przykłady

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

Zobacz też