Azure

Azure DevOps – Convert Basic UI Pipelines To YAML Pipelines

On this article, we are going to be taught a brand new method of changing an present Basic UI primarily based pipeline into YAML pipeline.

 

Overview

 

Azure Pipelines

 

Azure pipelines assist us in automating the construct and lots of different validation processes in a non-developer machines in order that we are able to improved the standard of the Construct.

 

Under are two completely different was in which you’ll be able to configure Construct Pipelines

  • Basic UI Pipelines
  • YAML Pipelines

Initially, Azure DevOps has solely the Basic UI primarily based pipelines. It had the beneath disadvantages.

  1. A number of engineers engaged on the identical pipelines was not simple
  2. Sustaining the variations of the Pipelines was nearly not attainable
  3. Submitting the Pipelines modifications to the superior for a overview was not attainable
  4. Reusability was attainable to some extent. Nonetheless, executing these reusable parts primarily based on some guidelines was not attainable.

With the help of YAML primarily based pipelines, all the above limitations isn’t any extra relevant now. Nonetheless, Basic UI primarily based pipelines supplies us a simple strategy for rapidly authoring the pipelines particularly for newbie’s, the Basic UI editor was a pleasant software to start out authoring the pipelines.

 

While you begin working with YAML, initially you won’t discover it simple to work with however slowly when you perceive tips on how to get the YAML code from numerous completely different locations, you’ll begin feeling comfy with YAML primarily based pipelines too.

 

On this article, we are going to find out how simple it’s to transform a Basic UI Pipeline into YAML primarily based pipelines with out authoring them from scratch.

 

Let’s begin by authoring a Pipeline utilizing Basic UI editor.

 

Creator a Class UI Pipeline

 

Under is a posh pipeline but with easy duties in it. As proven within the beneath screenshot, the beneath pipeline has two jobs with dependencies (Job2 is runs solely after Job1 is full).

 

Azure DevOps – Convert Basic to YAML Pipelines – Pipeline

 

Every of the Steps within the each the Jobs doesn’t do a lot besides it outputs some steps utilizing PowerShell.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Step

 

Additionally, you may need observed that the PowerShell makes use of a variable named $(welcomemessage) which is current within the variables part as proven within the beneath screenshot.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Basic UI Variables

 

And, as proven within the beneath screenshot, Job2 has a dependency on Job1

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Job Dependency

 

Now, with all these functionalities, if you want to transform these Class UI-based pipelines, you’ve got a brand new choice to obtain the entire YAML for the complete pipeline.

 

Let’s discover ways to do it.

 

Convert Class UI Pipeline to YAML Pipeline

 

On this part, we are going to discover ways to convert a Basic UI pipeline to YAML primarily based pipeline. Navigate to the definition of the Construct Pipeline by clicking on the Pipeline title. When you click on on the Pipeline title, you may be taken to the Pipeline definition web page as proven beneath

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Basic UI Definition

 

Now, click on on the three ellipses as proven within the above screenshot which opens up a context menu as proven beneath.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Export as YAML

 

Now, clicking on the Export to YAML button (proven above) will export the complete YAML file to your native machine.

 

Add the file to your repository as proven within the beneath screenshot.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – Add YAML to Repo

 

The subsequent step is to create a brand new Pipeline by clicking on the New Pipeline button after which observe the beneath steps.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – Choose Current YAML file

 

Now, click on on the Run button to execute the pipeline.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline Error

 

As proven within the above screenshot, the pipeline execution failed. Trying on the error message, it’s clear than it doesn’t perceive what welcomemessage is? It’s a variable that was created in Lessons UI primarily based Pipeline. That clearly signifies that the conversion to YAML deosn’t create all of the variable. Furthermore, in the event you return to the YAML file, there’s a remark (as proven beneath) that the variable welcomemessage was there within the variables tab.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – Variable Remark

 

We have to add that variable by clicking on the Variables button as proven beneath.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – Variable Button

 

and add a brand new variable known as welcomemessage as proven beneath.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – Variable Checklist

 

Let’s run the pipeline once more and as proven within the beneath screenshot, it has efficiently executed.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – YAML Job Execution

 

On this part, we’ve got learnt tips on how to convert Classis UI pipelines to YAML primarily based pipeline.

 

Modify YAML Pipeline for brand spanking new Necessities

 

In a day-to-day operation, a Devops engineer is accountable to make modifications to the prevailing pipeline. Let’s assume that the brand new requirement is so as to add a 3rd job once more utilizing PowerShell in each the Jobs. On this part, we are going to discover ways to add new duties to the prevailing pipeline utilizing the YAML Assistant

 

Now, navigate to the pipeline, place your cursor to the place you wish to add the brand new job by following the beneath steps.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – Add Further Steps

 

As proven within the beneath screenshot, you see a 3rd step which executed some PowerShell script.

 

Azure DevOps - Convert Classic UI Pipelines To YAML Pipelines

Azure DevOps – Convert Basic to YAML Pipelines – YAML Pipeline – YAML Job Further Steps Output

 

That’s it. We’ve got learnt tips on how to convert a Class UI primarily based pipeline into YAML with out realizing the fundamentals of YAML.

 

Completely satisfied Studying.

Tags
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close