Azure dev ops

Azure DevOps Yaml Cool Stuff

Azure DevOps Yaml Cool Stuff

Recently I have been migrating classic Azure DevOps pipelines to YAML. I didn’t create the original pipelines and the requirements of the build are quite specific. It’s been a great opportunity to learn some of

Multi line string variables

variables:
  - Name: var1
    value: |
        This is a multi-line variable
        and it goes across multiple lines

Templates and parameters

Objects

Loops

Resource properties as variables

trigger: none
resources:
  repositories:
    - repository: mycode
      type: git
      name: project/mycode
      ref: "refs/heads/main"
      trigger:
        branches:
          include:
            - main
            - release/*


variables:
  - name: codeRepoName
    value: $[ resources.repositories['mycode'].name]

  - name: codeRepoRef
    value: $[ resources.repositories['mycode'].ref]