Compartir a través de


definición de jobs.job

Un trabajo es una colección de pasos ejecutados por un agente o en un servidor.

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.

Definiciones que hacen referencia a esta definición: trabajos

Propiedades

job Cadena. Obligatorio como primera propiedad.
Identificador del trabajo. Valores aceptables: los nombres válidos solo pueden contener caracteres alfanuméricos y "_" y no pueden comenzar con un número.

displayName Cadena.
Nombre legible del trabajo.

dependsOn string | string list.
Cualquier trabajo que se debe completar antes de este.

condition Cadena.
Evalúe esta expresión de condición para determinar si se va a ejecutar este trabajo.

continueOnError Cadena.
¿Sigue ejecutándose incluso en caso de error?

timeoutInMinutes Cadena.
Tiempo para esperar a que se complete este trabajo antes de que el servidor lo mate.

cancelTimeoutInMinutes Cadena.
Tiempo para esperar a que el trabajo se cancele antes de terminarlo forzosamente.

variablesvariables.
Variables específicas del trabajo.

strategyjobs.job.strategy.
Estrategia de ejecución para este trabajo.

poolpool.
Grupo donde se ejecutará este trabajo.

containerjobs.job.container.
Nombre del recurso de contenedor.

services diccionario de cadenas.
Recursos de contenedor para ejecutarse como contenedor de servicios.

workspaceárea de trabajo.
Opciones del área de trabajo en el agente. Para obtener más información sobre las áreas de trabajo, incluidas las opciones limpias, consulte el tema área de trabajo en Trabajos.

usesjobs.job.uses.
Los recursos requeridos por este trabajo que aún no se han hecho referencia. Para más información sobre uses, consulte Limitación del ámbito de autorización de trabajos a repositorios de Azure DevOps a los que se hace referencia.

stepspasos.
Lista de pasos que se van a ejecutar.

templateContext templateContext.
Información relacionada con el trabajo pasada desde una canalización al extender una plantilla. Consulte la sección Comentarios para obtener más información. Para obtener más información sobre templateContext, consulte Plantillas de canalizaciones yaML extendidas ahora se puede pasar información de contexto para fases, trabajos e implementaciones yplantillas: use templateContext para pasar propiedades a plantillas.

Observaciones

El valor predeterminado timeoutInMinutes se establece en 60 minutos. Para obtener más información, vea Tiempos de espera.

Los trabajos se pueden ejecutar condicionalmente y pueden depender de trabajos anteriores.

Nota:

Si solo tiene una fase y un trabajo, puede usar la sintaxis de un solo trabajo como una manera más corta de describir los pasos que se deben ejecutar.

Ejemplos

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

Vea también