Creating Multiple Jobs

Creating Multiple Jobs

In the previous post, we talked about Creating Tasks. Today we will talk about the steps in creating multiple jobs.

When setting up a build pipeline for an application that needs to be built for multiple operating systems simultaneously, you often need to add an additional job to handle this. There are two types of jobs you can create: agent jobs and agentless jobs.

An agent job runs on an agent or target computer, while an agentless job runs directly on the Azure DevOps application server. Here are the steps to create additional agent jobs in a build pipeline:

1. Edit the build pipeline by clicking the ... symbol and selecting Edit:

Editing a Build Pipeline


2. Click on the ... button and select Add an agent job:

Adding an agent job

3. Click on Agent job and update the job information as follows:

Display name: Agent job 2

Agent pool: Azure Pipelines

Agent Specification: ubuntu-latest

Adding another New Job

4. Click on the + button for the job, type the Command line in the search box, and then click the Add button:

New Task Added

5. Click on the row with the Command Line Task and update the following fields:

Task version: This is a package version of the Command Line Task. We usually use the latest version. In our case, this is version 2.

Display name: Add a suitable name for your task. In our case, this is the Second Command Line Task.

Script: Add the following basic script – echo "Hello Second Task on Linux".

This will print out this text on the resultant page after you have finished running a pipeline:

Updating the second command line task

6. After you click Save & queue, you will see the following result:

The result of two agent jobs

Let’s look at some of the advanced options available in the Agent job properties, as shown in the following Picture:

Advance Option

Let’s look at these options in some detail:

Agent selection:

Agent Pool: Choose either a custom or default agent to execute the build jobs.

Demands: Specify condition parameters to ensure that only agents meeting these conditions can run the agent job. For instance, you can set it so that only a Linux agent is allowed to run this job.

Execution Plan:
Parallelism Options:        

- None: No jobs will run in parallel.

- Multi-configuration: Enable this when you need different configurations for each agent job. For instance, if you need to run tests on three browsers, you will need Chrome, Edge, and Firefox.

- Multi-agent: Enable this when you have multiple agents and need to use them to run an agent job.

Timeout: Enter the number of minutes an agent job is allowed to execute before being canceled.

Job Cancel Timeout: Enter the number of minutes an agent job can run after receiving a cancel request before it is forcibly stopped.

Dependencies: You can select a previous agent job that must complete successfully before running another agent job.

Additional Options:

- Allow scripts to access the OAuth token: Enable this if you need to use the OAuth token to pass information to another agent job via REST API.

Run This Job:

- Only when all previous jobs have succeeded

- Even if a previous job has failed

- Only when a previous job has failed

- Custom condition using variable expressions: For example, succeeded() means the agent job will run if the previous one is completed successfully.

In this section, you learned how to create a second job to separate the Linux operating system. This allows two jobs to run simultaneously, which is useful for running tasks on different operating systems independently. For example, you can create a build pipeline that deploys your application to both Google Play and the Apple Store simultaneously without sequential execution.

In our upcoming post, we'll explore how to create a trigger to automatically run a build pipeline.


Microsoft Learn Microsoft Azure Microsoft Azure DevOps






要查看或添加评论,请登录

Ankit Ranjan (DevOps Engineer)的更多文章

  • What is Azure Pipelines?

    What is Azure Pipelines?

    Azure Pipelines Benefits of Azure Pipelines Azure Pipelines offers a fast, reliable, and secure way to automate the…

  • Installing Docker on Windows 11 using WSL 2: A Step-by-Step Guide

    Installing Docker on Windows 11 using WSL 2: A Step-by-Step Guide

    Docker has become a crucial tool for developers, enabling seamless and portable application deployment. Prerequisites…

  • Safeguard Your Azure Route Server with Azure DDoS Protection

    Safeguard Your Azure Route Server with Azure DDoS Protection

    This guide walks you through securing your Azure Route Server by integrating it with Azure DDoS Protection in a virtual…

  • Protect your public load balancer with Azure DDoS Protection

    Protect your public load balancer with Azure DDoS Protection

    Azure DDoS Protection provides advanced mitigation features like adaptive tuning, attack alert notifications, and…

  • Create a public load balancer with an IP-based backend

    Create a public load balancer with an IP-based backend

    This Edition will teach us how to create a public load balancer with an IP-based backend pool. Traditionally, an Azure…

  • Load Balancer and its Different Types

    Load Balancer and its Different Types

    Global Load Balancer The Azure Standard Load Balancer enables cross-region load balancing, providing geo-redundant high…

  • Inbound NAT Rule

    Inbound NAT Rule

    Inbound NAT rules enable connections to virtual machines (VMs) in an Azure virtual network using a public IP address…

  • Azure Availability Set

    Azure Availability Set

    As part of a high-availability deployment, virtual machines are typically organized into multiple availability sets to…

    8 条评论
  • Azure Load Balancer (Part 2)

    Azure Load Balancer (Part 2)

    What is Azure Front Door Azure Front Door helps you deliver content, files, apps, and APIs with better availability…

  • Azure Load Balancer (Part-1)

    Azure Load Balancer (Part-1)

    Load balancing involves the efficient distribution of incoming network traffic across multiple backend servers or…

社区洞察

其他会员也浏览了