'Using Azure DevOps, how do I migrate a release pipeline to code, similar to build pipeline yml?

If I recall correctly, Azure Devops was set to add a feature to allow release pipelines to be placed into yaml , similar to build pipeline. Is this feature available yet?

Im hoping to get some guidance on the migration of legacy classic release pipeline, to the new format?

UPDATE: It looks like I'm only about 4 months behind. Posted on May 6, 2019

With our new updates, development teams can now leverage the same YAML documents to build multi-stage pipelines-as-code for both Continuous Integration and Continuous Delivery. This was one of the biggest requests from our customers

here are some helpful links for those that are like me : have many classic release pipelines manually created, interested in the new format.

https://azure.microsoft.com/en-us/updates/unified-pipelines/

https://azure.microsoft.com/en-us/blog/accelerating-devops-with-github-and-azure/



Solution 1:[1]

Create a new multi-stage pipeline-as-code. https://azure.microsoft.com/en-us/updates/unified-pipelines/

https://azure.microsoft.com/en-us/blog/accelerating-devops-with-github-and-azure/

Solution 2:[2]

I've discovered that Microsoft provides some built-in help to migrate a release pipeline from a classic GUI-based Release pipeline to a YAML-based pipeline.

If you edit your classic GUI-based Release pipeline and drill down to a task, there is a link at top right that says View YAML:

Task in a Release pipeline showing the View YAML link

Clicking the link generates the YAML associated with the task. Unfortunately it doesn't include the field values. Instead it uses variables and doesn't specify the values of those variables:

steps:
- task: IISWebAppManagementOnMachineGroup@0
  displayName: 'IIS Web App Manage'
  inputs:
    IISDeploymentType: '$(Parameters.IISDeploymentType)'
    ActionIISWebsite: '$(Parameters.ActionIISWebsite)'
    WebsiteName: '$(Parameters.WebsiteName)'
    WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\AspNetDemo'
    AddBinding: '$(Parameters.AddBinding)'
    Bindings: '$(Parameters.Bindings)'
    ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
    VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
    ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
    VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
    AppPoolName: '$(Parameters.AppPoolName)'

Luckily the task in the GUI has links against most fields, with field-specific help. That help mentions which variable maps to the field value:

Task in a Release pipeline showing the help linked to a field, highlighting the variable that maps to the field

So you can go through each field in the task determining which variable corresponds to each field, to work out what values to add to the YAML snippet.

It's a bit labour intensive but it's quicker than trying to figure it all out from scratch.

Unfortunately there doesn't seem to be any way to view the YAML at the job or stage level, only at the task level. So you'll have to repeat the process for each task. You'll also have to work out the YAML that defines the stage and the jobs yourself.

Solution 3:[3]

For migrating release classic pipelines, Azure DevOps still lacks some more straightforward support.

But there is an external tool, yamlizr, for helping migrate many release pipelines.

In my case I had to hack a bit the tool (see its issues if they are still opened).

The result is not production ready, but is still a good starting point from my viewpoint, and helps a lot.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jbooker
Solution 2 Simon Tewsi
Solution 3 Frédéric