I want to change the tfs variable BUILD_SOURCEBRANCHNAME
while building, using this powershell script in my build step:
##vso[build.sourcebranch]master
This doesn't throw errors, but is not working either?
How can I achieve this?
The syntax to change any environment variable in Azure DevOps is:
Write-Host "##vso[task.setvariable variable=someVar]varValue"
So in your case, if you want to "fake" the source branch:
$fakeBranch = "shayki"
Write-Host "##vso[task.setvariable variable=build.sourcebranch]$fakeBranch"
Write-Host "##vso[task.setvariable variable=build.sourcebranchname]$fakeBranch"
The variables before:
The script:
The variables after: