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: 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.

Definitioner som refererar till den här definitionen: jobb

Egenskaper

job sträng. Krävs som första egenskap.
ID för jobbet. Godtagbara 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 jobbet har slutförts innan servern avslutar det.

cancelTimeoutInMinutes sträng.
Tid att vänta tills jobbet avbryts innan det avslutas med två skäl.

variables variabler.
Jobbspecifika variabler.

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

pool pool.
pool där jobbet ska köras.

container jobs.job.container.
containerresursnamn.

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

workspace arbetsyta.
arbetsytealternativ på agenten. Mer information om arbetsytor, inklusive alternativ för rensning, finns i avsnittet arbetsyta i Jobb.

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

steps steg.
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 utökade YAML Pipelines-mallar kan nu skickas kontextinformation för steg, jobb och distributioner och mallar – Använd templateContext för att skicka egenskaper till mallar.

Anmärkningar

Standard timeoutInMinutes är inställt på 60 minuter. Mer information finns i timeouter.

Jobb kan köras villkorligt och kan vara beroende av tidigare jobb.

Anmärkning

Om du bara har ett steg och ett jobb kan du använda syntax för ett enda jobb 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