DEV Community

loading...
Cover image for Convert Azure Pipelines to YAML in 1 click!

Convert Azure Pipelines to YAML in 1 click!

n3wt0n profile image Davide Benvegnù ・2 min read

Let's say you have been working on a Classic Pipeline in Azure DevOps, and now you would like to convert it to YAML. Or perhaps you just want to learn the YAML Pipelines syntax referencing an existing Classic one.

Today we are gonna do just that, using the new Export to YAML feature.

Intro

Today we talk about the new Export to YAML feature of Azure Pipelines. This is the feature which helps you migrate designer pipelines to YAML.

You may want to read this post even if you have already used the "View YAML" feature that existed before, because this new feature is much better!

Video

As usual, if you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video with the whole explanation and demo, which to be fair is much more complete than this post.

(Link to the video: https://youtu.be/PD0JHHw0Or4)

If you rather prefer reading, well... let's just continue :)

It is more complete!

The new version is more correct and covers more Classic Build features.

The previous version of this feature worked on a job or step at a time. This was not only very time consuming, you had to click on each step and get the YAML, but also not very accurate.

The differences were typically subtle, small, and hard to spot.

The new experience takes a different tactic. It’s implemented in the platform, reusing existing Classic and YAML pipeline infrastructure to make sure the resulting YAML is correct.

How to use it

You may want to watch the video with the demo here

To use the new Export to YAML, you don't need to go editing the pipeline but just click on it.

Then you can just select the "Export to YAML" item from the ellipses menu.

This will download the whole pipeline converted in a YAML file that you can then edit and use to create a YAML Pipeline.

No more time consuming operations. Just one click and you have the full YAML. Isn't it cool?

Supported Features

In addition to being more correct, the new version covers more Classic pipeline features.

The new system knows how to handle every feature listed here:

Feature list

Unsupported Features

There are only 2 features that are not supported.

If you have UI variables in your Classic pipeline, those won't be exported but they will be mentioned by name in the comments to remind you that you need to configure them in your new YAML pipeline definition.

The other unsupported one is the cron timezone translation. Cron schedules in YAML are expressed in UTC, while Classic schedules are in the organization’s timezone.
Converting a cron expression to a different timezone is almost impossible. Believe me, I've tried.

Conclusion

I hope you enjoy the new, more correct and more complete “Export to YAML”. Let me know in the comment section below what your thoughts are, I think it is very useful.

Check the video below to see this in action:

Discussion (0)

pic
Editor guide