Reputation: 2964
It seems that name
is a special magic variable that somehow gets used for my output directory.
(Is this behavior documented anywhere?)
I'm trying to set it.
Given the extraordinary difficulty of writing Azure pipeline yml, it's highly unlikely that I'll get it right. In the absence of any form of debugging I want to add a print statement so that I can see the value.
How?
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
buildConfiguration: 'Release'
tag: ''
${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
buildConfiguration: 'Debug'
tag: ${{ format('-{0}', variables['Build.SourceBranchName']) }}
# How do you do string concatenation in yml? Do I need to do `format` like above?
name: $(Build.BuildId)$(tag)
steps:
- script: echo "name is $(name)"
But the output is
Generating script.
Script contents:
echo "name is $(name)"
...
name is $(name)"
Is it possible to make this work? How?
Upvotes: 9
Views: 28524
Reputation: 41545
The name
variable is for the Build.BuildNumber
value (see here).
So just print it:
- script: echo "name is $(Build.BuildNumber)"
Upvotes: 12