In Azure Pipleine YAML version the Build.Repository.Name predefined variable contains workspace/reponame
value in my case.
I wanted to remove the workspace/
prefix and use the result in a following step.
I tried many ways but without success, but it seems the replace expression maybe be good for me.
One tried solution:
variables:
myVariable: $[replace(variables['Build.Repository.Name'], 'workspace/', '')]
steps:
- bash: echo $(myVariable) # show nothing
As i read in documentation the Build.Repository.Name
does not accessible in this phase
The following runtime call show the correct value
steps:
- bash: echo $(Build.Repository.Name) # shows: workspace/reponame
Can I do something similar, and what is the correct way?
- bash: echo $(replace('$(Build.Repository.Name)', 'workspace/', ''))