microsoft/azure-pipelines-yaml

Enable 'repository.name' for accepting variables

brunoviveiros-dev opened this issue · 2 comments

I have plenty of Azure functions that have similar pipelines (build and release). This scenario leads me to have a bunch of "duplicated" pipelines. They only differ because it's linked to different repos. To achieve cleaner pipelines, I decided to create just one generic pipeline that will be able to build all existing Azure functions.

This was going well, but now I discovered that YAML resources:repositories:repository:name do not accept expressions, which blocked me from moving forward.

I want to ask to make the name possible for expressions as the ref is: https://learn.microsoft.com/en-us/azure/devops/release-notes/2022/sprint-212-update

This feature will bring great flexibility in Azure Pipelines, so instead of having 40 build pipelines, I can have only a generic one, which would be amazing.

Below is my current template:

parameters:
  - name: repositoryName
    type: string
    default: ""
  - name: branch
    type: string
    default: test
    values:
      - test
      - production
trigger:
  branches:
    include:
      - test
variables:
  repositoryPath: DataIntegration/_git/${{ parameters.repositoryName }}
  branchRef: refs/heads/${{ parameters.branch }}
resources:
  repositories:
    - repository: collectorRepository
      type: git
      name: DataIntegration/_git/Media.Collector.Retarget
      ref: ${{ variables.branchRef }}
jobs:
  - template: azure-pipelines-build-template.yml
    parameters:
      repositoryName: ""
      branch: ""

I want to use ${{ variables.repositoryPath }} instead of DataIntegration/_git/Media.Collector.Ret, that would be a good feature for sure.

Hi @brunoviveiros-dev, this repository is only for 'getting started' YAML templates, therefore we do not accept feature requests here that are related to custom YAML usage.
Please, place your suggestion in the Developer Community to get the right eyes on it.
Please let me know if you have any questions

Closing as external issue