Azure devops yaml pipelines get branches from different repo to use them as a value list in a param

Viewed 250

Scenario:

I have a azure git repo for all my infrastructure code (basically all my yaml files are there and are triggered from there for any other jobs needed).

I want to be able to get all branches from repository x and use them as a value list in a parameter.

Basically:

resources:
  repositories:
  - repository: repo_x
    type: git
    name: Proj/repo_x

"""
Something should happen here and give me a list of branches from repo_x 
in a variable 'branch_list'
"""

parameters:
  - name: branch
    displayName: Target branch
    type: string
    default: 'main'
    values: [branch_list]
1 Answers

when we trigger a pipeline, the branch list is already available, this defines in which version the pipeline will run, is this what you want ? enter image description here

Related