Problem
Build.SourceBranchName variable does not include the full branch name (e.g. feature/test is represented incorrectly as test). This requires pretty much everyone that deals with branches in their pipelines to write custom scripts to concatenate the full branch name together. The currently broken variable couldn't be fixed for backwards compatibility reasons, but I think we can all agree that the existing branch variable is pretty much useless if we have forward slashes in our branch name.Solution
Build.SourceBranchFullName that correctly includes the entire branch name)Notes
This would be very helpful. Build.SourceBranchName is wrong. If I have these branches:
dev/foo
hotfix/foo
The Build.SourceBranchName will be "foo" for both of them which is incorrect, unexpected, and can lead to downstream CI/CD confusion and errors. For backward compatibility, having a Build.SourceBranchFullName would suffice.
Me2!!! This really problematic for us.
I found Build.SourceBranch that provides me with the necessary branch information. Does this help?
I found
Build.SourceBranchthat provides me with the necessary branch information. Does this help?
No, this doesn't help because it is prefixed with "refs/head/" or something like that. You can manipulate that string to get the full branch name but it does not provide it automatically.
I really could use this variable. I can't believe the way they implemented Build.SourceBranchName.
I found
Build.SourceBranchthat provides me with the necessary branch information. Does this help?No, this doesn't help because it is prefixed with "refs/head/" or something like that. You can manipulate that string to get the full branch name but it does not provide it automatically.
AFAIK, the Build.SourceBranch does not provide the correct branch _name_ for Pull Requests as it provides something like refs/pull/1/merge (see Azure Docs on Build Variables), which is the internal branch, but not helpful for anything where the (corresponding) corresponding branch name is necessary. So, it's not solely an issue of providing it automatically (which would be just for convenience).
Hi everyone, since this issue is related to adding of new variable - could you please create ticket on https://developercommunity.visualstudio.com/spaces/21/index.html to get right eyes on it? Let me close this one since it doesn't seem to be related to the agent itself.
Most helpful comment
AFAIK, the
Build.SourceBranchdoes not provide the correct branch _name_ for Pull Requests as it provides something likerefs/pull/1/merge(see Azure Docs on Build Variables), which is the internal branch, but not helpful for anything where the (corresponding) corresponding branch name is necessary. So, it's not solely an issue of providing it automatically (which would be just for convenience).