Dela via


jobs.job definition

Ett jobb är en samling steg som körs av en agent eller på en 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: 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.

Definitioner som refererar till den här definitionen: jobb

Egenskaper

job Sträng. Krävs som första egenskap.
ID för jobbet. Acceptabla värden: Giltiga namn får bara innehålla alfanumeriska tecken och '_' och kanske inte börjar med ett tal.

displayName Sträng.
Läsbart namn för jobbet.

dependsOn sträng | stränglista.
Alla jobb som måste slutföras före den här.

condition Sträng.
Utvärdera det här villkorsuttrycket för att avgöra om jobbet ska köras.

continueOnError Sträng.
Vill du fortsätta köra även vid fel?

timeoutInMinutes Sträng.
Det är dags att vänta tills det här jobbet har slutförts innan servern avlöser det.

cancelTimeoutInMinutes Sträng.
Det är dags att vänta tills jobbet avbryts innan det avslutas med två skäl.

variablesvariabler.
Jobbspecifika variabler.

strategyjobs.job.strategy.
Körningsstrategi för det här jobbet.

poolpool.
Pool där det här jobbet ska köras.

containerjobs.job.container.
Namnet på containerresursen.

services strängordlista.
Containerresurser som ska köras som en tjänstcontainer.

workspacearbetsyta.
Arbetsytealternativ för agenten. Mer information om arbetsytor, inklusive rena alternativ, finns i avsnittet om arbetsytor i Jobb.

usesjobs.job.uses.
Alla resurser som krävs av det här jobbet som inte redan refereras. Mer information om usesfinns i Begränsa jobbauktoriseringsomfånget till refererade Azure DevOps-lagringsplatser.

stepssteg.
En lista över steg som ska köras.

templateContext templateContext.
Jobbrelaterad information som skickas från en pipeline när du utökar en mall. Mer information finns i kommentarer. Mer information om templateContextfinns i Extended YAML Pipelines templates can now be passed context information for stages, jobs, and deployments and Templates – Use templateContext to pass properties to templates .

Kommentarer

Standardvärdet timeoutInMinutes är 60 minuter. Mer information finns i Timeouter.

Jobb kan köras villkorligt och kan bero på tidigare jobb.

Anteckning

Om du bara har ett steg och ett jobb kan du använda enstaka jobbsyntax som ett kortare sätt att beskriva stegen som ska köras.

Exempel

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

Se även