[Enter feedback here]
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
the example goes like:
$(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
Could we have something like
$(Date:yyyyMMdd)-$(Time:hhMMSS)-$(SourceCommitHash)
?
any updates on that?
Thank you for paying attention to my question.
I tried it and it works, but in case of Git I get long hash commits, not very usable as part of BuildNumber.
This proposal
https://developercommunity.visualstudio.com/idea/1026034/add-support-substring-functions-in-azure-pipelines.html
contains solution, but it's not implemented yet... is it?
You're welcome.
Thank you for providing the link, we can see if the product team will implement an easier way to handle this.
For now, directly formatting variable strings is not yet supported and the work-around is to use PowerShell, please refer to this post.
I'd recommend something like:
- bash: |
HASH=$(git rev-parse --short $BUILD_SOURCEVERSION)
echo "##vso[build.updatebuildnumber]mybuildname-$HASH"