microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.19k stars 926 forks source link

Dynamically determine repository resources #537

Closed sebastianbirk closed 3 years ago

sebastianbirk commented 3 years ago

We have a design where we want to share one pipeline repository (e.g. test_repo_0) that contains our ADO pipelines among multiple model repositories (e.g. test_repo_1 and test_repo_2) with a multi-repository checkout strategy. The model repository that needs to be checked out to the ADO agent has to be determined dynamically. For the checkout steps we can do that using parameters (specifying either test_repo_1 or test_repo_2).

image

However, for the repository resources we did not find a way to do that dynamically. Instead we have to hardcode all the repositories. Is there a good way to parameterize this? Our problem is that this approach is not very scalable and we want to roll it out to a huge user base.

image

FlorianPydde commented 3 years ago

Hi,

We are also facing this issue. We want to restrict users to only be able to run a pipeline but not modify it. The later pipeline will have to pick up some code/configs from another repo where the client pushes all the code. Is there a way to specify the repo name dynamically without listing the repo in the "resources" variables (like the one provided above) ?

anatolybolshakov commented 3 years ago

Hi @sebastianbirk @FlorianPydde did you try to use 'each' expression? You can find more details about it in docs.

sebastianbirk commented 3 years ago

Hi @anatolybolshakov thanks for the hint. How can we get a list of all repositories in the ADO project to loop over? Because that is what would be needed for the 'each' expression, right? We want to add all repositories that are in the ADO project to the repository resources section of the pipeline.

anatolybolshakov commented 3 years ago

@sebastianbirk I'm not sure if it's possible at the moment to retrieve it from variable - you can only specify it as list above. This repo is mostly for yaml templates - if you want this as a new feature - please feel free to open a ticket on https://developercommunity.visualstudio.com/search?space=21

anatolybolshakov commented 3 years ago

@sebastianbirk please let us know if you have any further questions.

FlorianPydde commented 3 years ago

@anatolyboshakov thanks for providing the link for the feature request.

anatolybolshakov commented 3 years ago

@FlorianPydde feel free to open ticket on https://developercommunity.visualstudio.com/search?space=21 Let me close this one since it's not related to yaml templates provided in this repo.