Skip to content

Latest commit

 

History

History
349 lines (282 loc) · 15.1 KB

jobs-job.md

File metadata and controls

349 lines (282 loc) · 15.1 KB
title description ms.date monikerRange
jobs.job definition
A job is a collection of steps run by an agent or on a server.
11/20/2024
<=azure-pipelines

jobs.job definition

:::moniker range="<=azure-pipelines"

A job is a collection of steps run by an agent or on a server.

:::moniker-end

:::moniker range=">=azure-pipelines-2022"

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.

:::moniker-end

:::moniker range="=azure-pipelines-2020.1"

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.

:::moniker-end

:::moniker range="=azure-pipelines-2020"

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.

:::moniker-end

:::moniker range="=azure-pipelines-2019.1"

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 # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # A list of steps to run.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

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: outputs | resources | all # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # A list of steps to run.

:::moniker-end

:::moniker range="<=azure-pipelines"

Definitions that reference this definition: jobs

:::moniker-end

Properties

:::moniker range="<=azure-pipelines"

job string. Required as first property.
ID of the job. Acceptable values: Valid names may only contain alphanumeric characters and '_' and may not start with a number.

:::moniker-end

:::moniker range="<=azure-pipelines"

displayName string.
Human-readable name for the job.

:::moniker-end

:::moniker range="<=azure-pipelines"

dependsOn string | string list.
Any jobs which must complete before this one.

:::moniker-end

:::moniker range="<=azure-pipelines"

condition string.
Evaluate this condition expression to determine whether to run this job.

:::moniker-end

:::moniker range="<=azure-pipelines"

continueOnError string.
Continue running even on failure?

:::moniker-end

:::moniker range="<=azure-pipelines"

timeoutInMinutes string.
Time to wait for this job to complete before the server kills it.

:::moniker-end

:::moniker range="<=azure-pipelines"

cancelTimeoutInMinutes string.
Time to wait for the job to cancel before forcibly terminating it.

:::moniker-end

:::moniker range="<=azure-pipelines"

variables variables.
Job-specific variables.

:::moniker-end

:::moniker range="<=azure-pipelines"

strategy jobs.job.strategy.
Execution strategy for this job.

:::moniker-end

:::moniker range="<=azure-pipelines"

pool pool.
Pool where this job will run.

:::moniker-end

:::moniker range=">=azure-pipelines-2019.1"

container jobs.job.container.
Container resource name.

:::moniker-end

:::moniker range="<=azure-pipelines"

services string dictionary.
Container resources to run as a service container.

:::moniker-end

:::moniker range="<=azure-pipelines"

workspace workspace.
Workspace options on the agent. For more information about workspaces, including clean options, see the workspace topic in Jobs.

:::moniker-end

:::moniker range=">=azure-pipelines-2020.1"

uses jobs.job.uses.
Any resources required by this job that are not already referenced. For more information about uses, see Limit job authorization scope to referenced Azure DevOps repositories.

:::moniker-end

:::moniker range="<=azure-pipelines"

steps steps.
A list of steps to run.

:::moniker-end

:::moniker range=">=azure-pipelines-2022"

templateContext templateContext.
Job related information passed from a pipeline when extending a template. See remarks for more information. For more information about templateContext, see Extended YAML Pipelines templates can now be passed context information for stages, jobs, and deployments and Templates - Use templateContext to pass properties to templates.

:::moniker-end

Remarks

The default timeoutInMinutes is set to 60 minutes. For more information, see Timeouts.

Jobs can run conditionally and might depend on earlier jobs.

Note

If you have only one stage and one job, you can use single-job syntax as a shorter way to describe the steps to run.

:::moniker range="azure-pipelines"

For more information about templateContext, see Extended YAML Pipelines templates can now be passed context information for stages, jobs, and deployments and Templates - Use templateContext to pass properties to templates.

:::moniker-end

Examples

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

See also