1

We are using Azure devops for our CI/CD. Typically, all the CI are written as azure yaml files and the release jobs have to be created on devops portal (using GUI). One of the general principle which we want to follow is to have everything as code.

Questions:

  1. Can Azure release pipelines be created as code (yaml , etc) ?
    • I spent some time on it and it seems it is limited. Please correct me if i am wrong here.
  2. Release pipelines have numerous things like approvals, auto trigger, release trigger, etc . Is it possible with release pipelines in yaml ?
SunilS
  • 2,030
  • 5
  • 34
  • 62
  • 1) Yes, using JSON . 2) Yes, using JSON. – Cid Jun 26 '20 at 07:35
  • I suggest you to export an existing release configuration to see how it looks like (the 3 dots button next to the blue *create release* one, then click export) – Cid Jun 26 '20 at 07:38
  • @Cid: that is just exports ( and a huge one). We want to code the release pipeline – SunilS Jun 26 '20 at 07:48
  • Does this answer your question? [Azure DevOps, YAML release pipelines?](https://stackoverflow.com/questions/52323065/azure-devops-yaml-release-pipelines) – Shayki Abramczyk Jun 26 '20 at 08:04
  • I don't think it provides the features which UI provides .. like approvals ? – SunilS Jun 26 '20 at 08:21
  • That is one of my big gripes, the release YAML seems to have some features. The classic UI has some. They don't have full feature parity between the two. My impression though is that there will not be any new development on the classic UI release pipelines though. – Matt Jun 26 '20 at 16:26
  • That being said, you might check out this [link](https://devblogs.microsoft.com/devops/announcing-general-availability-of-azure-pipelines-yaml-cd/), it seems to imply in there that leveraging the CD pipelines you can support the approvals. – Matt Jun 26 '20 at 16:29
  • Hi SunilS, is there any update for this issue? Please check my answer and feel free to let me know if you have any concern about my answer :) – LoLance Jul 02 '20 at 03:04
  • I have trying to create a multi staged release pipeline using yml file inside Azure DevOps. It have come to the conclusion that as of current date it is not possible with YML file only. Although it is possible to create a multi stages build pipeline using YML file, but that not what you are asking for. The code that @Lance Li-MSFT has displayed created a multi staged build pipeline only. – Mohammad S. Sep 21 '20 at 12:03

1 Answers1

0

Azure deployments can be configured with code. You can add multiple release triggers (pipeline, pull request etc.) Approvals can be configured per environment (https://www.programmingwithwolfgang.com/deployment-approvals-yaml-pipeline/), then reference the environment in your pipeline.

The example below is triggered when its own yaml code changes and when the Build pipeline completes.

trigger:
  branches:
    include: 
    - myBranch
  paths:
    include:
    - '/Deployment/azure-deploy.yml'

resources:
  pipelines:
  - pipeline: BuildPipeline 
    project: myProjectName
    source: 'myBuildPipeline'
    trigger:
      enabled: true
 
jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: $(environment)
    pool:
      vmImage: 'windows-latest'

    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureRmWebAppDeployment@4
            displayName: Deploy Web App
            inputs:
              ConnectionType: 'AzureRM'
              azureSubscription: $(azureSubscription)
              appType: 'webApp'                
              appSettings: 
                -SETTING-1 "$(mySetting1)"          
              WebAppName: '$(myAppName)'
              package: '$(Pipeline.Workspace)/**/*.zip'


  [1]: https://www.programmingwithwolfgang.com/deployment-approvals-yaml-pipeline/
Rachel
  • 686
  • 1
  • 6
  • 18