Delen via


jobs.job definition

Een taak is een verzameling stappen die worden uitgevoerd door een agent of op een server.

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 # 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.
  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 # 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.
  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 # What to clean up before the job runs.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.

Definities die naar deze definitie verwijzen: taken

Eigenschappen

job tekenreeks. Vereist als eerste eigenschap.
id van de taak. Acceptabele waarden: geldige namen mogen alleen alfanumerieke tekens en _bevatten en beginnen mogelijk niet met een getal.

displayName tekenreeks.
leesbare naam voor de taak.

dependsOn tekenreeks | tekenreekslijst.
alle taken die vóór deze taak moeten worden voltooid.

condition tekenreeks.
Evalueer deze voorwaardeexpressie om te bepalen of deze taak moet worden uitgevoerd.

continueOnError tekenreeks.
Doorgaan met uitvoeren, zelfs bij een fout?

timeoutInMinutes tekenreeks.
Tijd om te wachten tot deze taak is voltooid voordat de server deze doodt.

cancelTimeoutInMinutes tekenreeks.
Tijd om te wachten totdat de taak wordt geannuleerd voordat deze geforceerd wordt beëindigd.

variables variabelen.
taakspecifieke variabelen.

strategy jobs.job.strategy.
uitvoeringsstrategie voor deze taak.

pool zwembad.
pool waar deze taak wordt uitgevoerd.

container jobs.job.container.
containerresourcenaam.

services tekenreekswoordenlijst.
Container-resources die moeten worden uitgevoerd als een servicecontainer.

workspace werkruimte.
werkruimteopties op de agent. Zie het onderwerp werkruimte in Takenvoor meer informatie over werkruimten, inclusief schone opties.

uses jobs.job.gebruikt.
Hiermee geeft u resources op die vereist zijn voor deze taak die nog niet elders in de pijplijn worden genoemd, bijvoorbeeld door een uitcheckstap of een opslagplaatsresource. Zie uses en 'gebruikt' voor het vooraf declareren van resources voor meer informatie.

steps stappen.
een lijst met stappen die moeten worden uitgevoerd.

templateContext templateContext.
taakgerelateerde informatie die is doorgegeven vanuit een pijplijn bij het uitbreiden van een sjabloon. Zie opmerkingen voor meer informatie. Zie voor meer informatie over templateContextuitgebreide YAML Pipelines-sjablonen nu contextinformatie kunnen worden doorgegeven voor fasen, taken en implementaties en -sjablonen- TemplateContext gebruiken om eigenschappen door te geven aan sjablonen.

Opmerkingen

De standaard timeoutInMinutes is ingesteld op 60 minuten. Zie Time-outsvoor meer informatie.

Taken kunnen voorwaardelijk uitvoeren en kunnen afhankelijk zijn van eerdere taken.

Notitie

Als u slechts één fase en één taak hebt, kunt u syntaxis van één taak gebruiken als een kortere manier om de stappen te beschrijven die moeten worden uitgevoerd.

Zie voor meer informatie over templateContextuitgebreide YAML Pipelines-sjablonen nu contextinformatie kunnen worden doorgegeven voor fasen, taken en implementaties en -sjablonen- TemplateContext gebruiken om eigenschappen door te geven aan sjablonen.

Voorbeelden

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

Zie ook