In the previous chapter, we discussed a couple of important features related to release pipelines. The service connections allowing various deployment targets with release management were described. Further, we explored usage of templates available for release pipeline implementation, stages in release pipelines to implement release workflow, and a way to set up triggers, approvals, and gates. The new feature environment was also discussed to understand its usage.
As a continuation from the previous chapter, we will explore agent jobs, deployment group jobs, and agentless job phases and their usage. Then we briefly discuss variables and their usage in release pipelines, which is more or less similar to usage of variables in build pipelines.
Lesson 10.01: Agent Jobs
Agent jobs require an installed Azure DevOps agent to execute the job. Agent machines can be hosted agent machines or on-premise machines depending on the targets of deployment, which we discuss in this lesson.
If you are deploying to a cloud target such as Azure or AWS, you can use Microsoft hosted agents to execute deployment actions. However, if you are deploying to an on-premise target or a more secure Azure target such as Azure App Service Environment, you might need to set up your own deployment agent machine. Most of the time the on-premise environment would be behind a corporate firewall, and the hosted agents will not have a line of sight to execute deployments against such targets. Similar to that, in an Azure App Service Environment (ASE), access to even platform services would be allowed only within the defined virtual network in Azure ASE. Hence, you need to set up a virtual machine configured as an Azure DevOps agent, inside the Azure ASE virtual network, which can access the platform services in an Azure ASE.
You can set the Allow scripts to access the OAuth token in an agent phase so that any script task in an agent job can use the system access token to access a REST API of Azure DevOps.
There are two timeout settings available for agent jobs. A timeout defines how much time a job can be executed in the agent. A job cancellation timeout defines how much time a job is given to complete when a cancellation request is made before the server terminates the job.
You can use many tasks available by default in Azure DevOps as well as tasks getting added with the marketplace extensions in Agent jobs to execute the required deployment steps. These deployment steps may involve setting up infrastructure of a given environment target, deploy your applications, and even executing functional and integration tests. In the marketplace for Azure DevOps, you can find tasks supporting various platforms and almost all actions you are required to do. If a task cannot be found, you can implement them on your own, which we will discuss in more detail in Chapter 11. You can group your tasks as task groups to reuse them in multiple agent jobs, and we talked about task groups in Chapter 2.
In this lesson, we discussed using agent jobs in release pipelines.
Lesson 10.02: Deployment Group Jobs
Deployment group jobs are meant to execute on defined deployment groups. We have talked about deployment groups and deployment pools and how they can be added with target machines with roles in Chapter 2 of this book.
Similar to an agent job, the deployment group job also has a timeout and job cancellation timeout settings that you can use to determine how much time a job can be executed before timing out and how much time is allowed to complete the job once a cancellation request is made before terminating, respectively.
Similar to agent jobs in the deployment groups, you can also define which of the artifacts are to be downloaded in a given job. OAuth token access and execution of jobs based on conditions can be also set similarly to agent jobs. These features can be used to define rollback and test execution scenarios with deployment groups as we have explained with agent jobs in the previous lesson. When using test executions, the role in such a machine can be a test client role based on a tag such as TestClient.
The tasks can be used in deployment group phases similar to agent jobs to achieve deployments based on their target roles. Even in the marketplace tasks, task groups can be utilized as required.
In this lesson, we explored the options available in the deployment group jobs to set up release pipelines in Azure DevOps.
Lesson 10.03: Agentless Jobs
You can use delay steps to wait for a given time after a given agent or deployment group job, using an agentless phase. Once the delay time is passed, the next agent or deployment group job can be executed. This type of delay would be useful in scenarios such as when you are provisioning infrastructure on cloud platform targets. There might be time requirements once infrastructure commands are executed on such cloud platforms to provision the required platform resources. Therefore, the delay task could be used to wait on such a required time.
Similar to gates applied between stages of a pipeline, in pre- and post-deploy stages, you can utilize the agentless phase to implement such gating between agent or deployment group jobs or by using tasks such as Invoke Azure Function, Invoke REST API, Query Azure Monitor Alerts, and Query Work Item tasks. For more information about gating, refer to Chapter 9.
The manual intervention task can be used to implement an approval, a rejection step in between the agent, or the deployment group jobs. These approvals can be useful in scenarios such as where you want to manually perform an action before executing the next steps of the pipeline.
In this lesson, we discussed the agentless phase and usage of the agentless steps in release pipelines.
Lesson 10.04: Variables
Variables can be reused using a $(variablename) in another variable as it automatically resolves. This is useful to repeating values in multiple variables and makes sure variables are containing unique values, and changing one place is only required to change variable values.
In this lesson, we discussed variables and their usage in release pipelines.
Lesson 10.05: Other Useful Features
Release pipelines have a couple of other useful features: in the retentions tab, options tab, history, tab and in a release menu such as import, export options.
The history of the release pipeline provides information about revisions in the release pipeline where you can make comparisons of versions as well as revert to a given version if required.
In this lesson, we discussed a few of the useful options available with release pipelines.
Summary
In this chapter, we explored agent jobs, deployment group jobs, and agentless jobs and their usage in detail. Additionally, we looked at a few other features such as variables, options, integrations, retention settings, and histories of release pipelines and their usage.
In the next chapter, we explore the REST API and the command-line interface features and the usage of them.