Wednesday 18 November 2020

Enhanced YAML Conversion for Azure DevOps Classic Build Pipelines

Azure DevOps YAML pipelines is the way to implement pipeline as code and version control the pipelines alongside your application code. However, among Azure DevOps users classic build pipelines are still popular due to its simple, visual ability to implement and understand faster etc. Additionally, classic pipeline agent job or individual step could be converted to YAML by using “View YAML” option available in each step/task as well as for a given agent phase. With a recent update to Azure DevOps new feature has been added to enable exporting entire classic build pipeline as YAML replacing the “View YAML” feature. This is a great improvement feature added to Azure DevOps as “View YAML” feature was only able to consider information in web UI when generating YAML out of classic pipeline, which at times generated incorrect YAML. With the new export YAML feature, now you can derive a reliable YAML implementation of a given classic pipeline. This would help people to implement pipeline quickly using classic pipeline UI and convert and obtain a YAML, which would help pipeline as code adoption easier. Let’s look at how we can use this new export to YAML feature.

Previous View YAML Feature

In a classic pipeline you could click on an agent phase and click on “View YAML” which has shown a pop-up window with the generated YAML that can be copied to clipboard.

When you click the “View YAML” now you will see a op-up message saying feature is moved.

New Export YAML Feature

In a build’s Runs page where you can view all the runs of a give build, you can click on the three dots menu. IN the menu you can see the Export to YAML menu item.

Once clicked correct YAML file of the build will be generated and downloaded to your machine. The downloaded YAML contains the comments mentioning the variables you have to setup in variables section for the YAML pipelines as well.

You can add the exported YAML file to the repo, create a pipeline with the YAML and then define the variables in the YAML pipeline and use it.

No comments:

Popular Posts