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

后端 未结 2 2005
囚心锁ツ
囚心锁ツ 2021-01-27 00:46

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?

<
相关标签:
2条回答
  • 2021-01-27 01:14

    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:

    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:

    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.

    0 讨论(0)
  • 2021-01-27 01:19

    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/

    0 讨论(0)
提交回复
热议问题