As you all know I'm no great fan of TFS. Since I last talked about TFS things have improved somewhat.
Let me tell you a brief story.
PART 1
Two weeks ago I was doing a very quick engagement for a utility company, mostly to help out a friend more than anything. The engagement was only for three days. As they had no CI capability I set up a Jenkins box and tried to integrate with the Bonobo Git server on the same box. Jenkins failed check it out the code...we think because certificates needed to be set up. Due to time constraints we got approval to move the code to a private GitHub repo. Problem solved.
PART 2
Just this week, at my latest engagement (in the same building I'd just left 3 weeks earlier but that's another story!), I was confronted with a TFS server and a request to set up a CI build. I recommended Jenkins and Git. I expected they would take more convincing to move away from TFS as a build server, however fortunately they did their own research and came around to my thinking that TFS as a build server is just not as good as Jenkins. The difficult part was that private GitHub repositories would not be allowed in this corporate environment. (This corporate is very behind the times!)
PART 3
We struggled for a couple of days to setup a git repo we could control in the (overly locked down) dev environment that we had been given. In the end we abandoned this endeavor...we tried all manner of things, even a git backed repository in TFS 2013...just too hard.
I thought I'd take another look at the TFS plugin for Jenkins and was very pleased to see that it has recently been through a major rewrite. Version 4.0 of the plugin was released on August 27th, 2015....and it works!
The trick is to get the settings "just so".
- In the job config select the Team Foundation Server option from the Source Management section.
- In the Server URL field enter https://<tfs-server-name>:<port>/tfs/<collection-name>
- In the Project path field enter $/path/to/root/of/my/solution
- In the User name field enter the user name that has access to TFS
- In the User password field enter the password associated with the user name
I didn't enter anything else.
Points to note:
- The Server URL has to be html escaped. So, for instance my <collection-name> had spaces in it, so My Collection Name becomes My%20Collection%20Name. If your <tfs-server-name> or <collection-name> has other special characters they will also have to be correctly escaped.
- The User name doesn't have to be an email address. In my case it wasn't.
If you don't get the above settings correct (I initially didn't know I had to include the collection name), you'll probably get an error such that it can't find a SOAP endpoint.
Get it correct, however and BAM! your Jenkins workspace will be populated with your source code.
Now it is easy integrate Jenkins with TFS such that you can get the code out of TFS and work with it in a Jenkins build.
Hopefully this has been helpful to someone out there. Let me know in the comments. I always like to hear your feedback.
Till next time...