According to https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=tfs-2018
These variables are automatically set by the system and read-only. (The exceptions are Build.Clean and System.Debug.)
Nonetheless, if one tries to create a vnext build with the following tasks
- Inline Powershell -
Write-Host $env:BUILD_SOURCEVERSION
- Inline Powershell -
Write-Host ("##vso[task.setvariable variable=build.sourceversion;]"+'someNewValue')
- Inline Powershell -
Write-Host $env:BUILD_SOURCEVERSION
Task 2 won't fail, and the last task will output something like
2018-10-24T07:37:23.1232438Z someNewValue
instead of the expected original source version (the value printed in the first task).
So,
- Either I am misreading the docs / they are unclear on that account
- Or is it some genuine defect in TFS that one should pursue with MS?