From the documention you can format the build number for the azure devops build pipeline but the formating on the time isn't working for me.
I want something like
YY.MM.DD.MMSS
name: $(Date:yy).$(Date:MM).$(Date:dd).$(Hours)$(Minutes)
However this will generate single digits like '20.08.12.150' for 3pm. Does anyone know a way of forcing the format like the date fields so it will always be 2 chars? $(Hours:hh)$(Minutes:mm) does not work; I did try that.
Thanks
Instead of define the build number in name:
of yaml file, you could add a powershell task to update the build number with command ##vso[build.updatebuildnumber]build number
. Check the following example:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Set-TimeZone -Id "China Standard Time"
[string] $dateTime = (Get-Date -Format 'yy.MM.dd.HHmm')
Write-Host "Setting the name of the build to '$dateTime'."
Write-Host "##vso[build.updatebuildnumber]$dateTime"