"The value specified for SourceVersion is not a valid Commit ID" when queueing a new build in Visual Studio Online and how I "fixed" it.
Configuring automated builds on the repositories hosted under my Visual Studio Online account has been on my todo list for a while. Today, I have finally gotten around to taking the first steps in setting this up. Unfortunately, I ran into some trouble, but thankfully I only wasted about 15 minutes, before I was able to figure it out on my own. Hopefully this saves you some time if you come across this!
Now, I am not going to cover the process of creating a build definition, as the documentation over at Visual Studio Docs can explain it in more detail.
I wanted to make sure that I could trigger a manual build for now, before setting up continuous integration and triggering builds each time a commit was made. With that being said, that mindset was probably the reason for my first fault.
Clicking Queue new build… under my build definition, would trigger an error message stating…
“The value specified for SourceVersion is not a valid Commit ID”
Shame on me, since I was triggering a manual build, I made the assumption that “Commit” at this dialog was just a label that would be applied when I view the specific build. I was thinking it would just pull the latest code from master. Then it clicked that we can trigger builds from branches other than master, so of course this would need to be an actual commit reference. Moving on…
So, I run over to the Code -> History section in VSO and click on the latest commit, grabbing the commit reference from the below location.
Alright, so going back over to the Queue new build… process, I plug in that commit id, but still get the same error message. Okay, what the hell, valid commit, Y U NO WORK!?
Now that I think of it, that seems like a shortened version of a commit id. Or at least from what I recall when I used to work with GIT on the command line, years ago. I’m sure there is a way to pull this from the command line, but most of my interaction is by using Team Explorer nowadays. Looking around on my commit page in VSO, I hover over the commit ID and the following tooltip appears “Copy full SHA to clipboard”, low and behold, that looks a bit longer.
Heading back over to the Queue new build… section and plugging in the full SHA commit ID… Houston, we now have liftoff!