How to get information about resources in an Azure Pipelines run? I work in a platform team that builds and supports Azure Pipelines YAML templates and various custom scripting for these pipelines. People in my organisation use these YAML templates like:
resources:
  repositories:
    - repository: templates
      type: git
      name: PROJECT/cicd_stuff
      ref: refs/heads/releases/v0.21
extends:
  template: our_awesome_template.yml@templates
  parameters:
    ...

In order to reliably match the version of our scripts to the version of the YAML templates, we now include an extra build stage in our pipeline templates that checks out the repo templates repo and puts all our scripts in an artifact to be used in that run. Using &quot;release branches&quot; allows us to safely put out and test new features and fixes to our pipelines: Teams can upgrade their pipeline on their own pace, with older version remaining supported for a while.
I'd like to start using Azure Artifacts for our script artifacts, but now I'm wondering &quot;how can I determine which version of my scripts I should be downloading from Azure Artifacts?&quot; The information included in the resources block would work for me, but I can't seem to access that with an expression or with a predefined variable. The only solution I can currently think of is to use the az pipelines cli. Any thoughts?
You can do:
variables:
  templates.ref: $[ resources.repositories['templates'].ref ]

See Repository Details docs.