How can I combine expressions and predefined variables to get my build repository name as an uppercase string?

Viewed 107

I'm trying to get my build repository name as an uppercase string combining predefine variables and expressions on Azure Devops as follows:

variables:
  repoNameUpper: $[upper(variables['Build.Repository.Name'])]

- script: |
    echo $(repoNameUpper)

Yet I get no output from it, what am I doing wrong here?

Yes, I know I could set a variable to achieve what I need using a bash script, yet I think it would not be so cool.

1 Answers

It because the Build.Repository.Name is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task. in another words - is not known at plan compile time, only at job execution time.

enter image description here

You can find more info in this GitHub issue.

Related