kuda.ai

Thoughts on programming and music theory.

azure devops: spread long conditions to multiple lines

Created on April 30, 2025

AzureDevOps/YAML

instead of this:

# 130 character width
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), ${{ eq(parameters.prodDeployment, true) }})

do this:

condition: >
  and(
    succeeded(),
    eq(variables['Build.SourceBranch'], 'refs/heads/develop'),
    ${{ eq(parameters.prodDeployment, true) }}
  )

Bonus: This is the parameter condition that you can choose when you trigger the pipeline:

parameters:
- name: prodDeployment
  type: boolean
  default: false
  values:
  - false
  - true