Why won't my 2008 Team Build trigger on developer check-ins despite CI being enabled - tfs

I have a Team Foundation Server 2008 Installation and a separate machine with the Team Build service.
I can create team builds and trigger them manually in Visual Studio or via the command line (where they complete successfully). However check ins to the source tree do not cause a build to trigger despite the option to build every check in being ticked on the build definition. Update: To be clear I had a fully working build definition with the CI option enabled.
The source tree is configured is a pretty straight forward manner with code either under a Main folder or under a Branch\branchName folder. Each branch of code (including main) has a standard Team Build definition relating to the solution file contained within. The only thing that is slightly changed from default settings is that the build server working folder; i.e. for main this is Server:"$\main" Local:"c:\build\main" due to path length.
The only thing I've been able to guess at (possible red herring) is that there might be some oddity with the developer workspaces. Currently each developer maps Server:"$\" to local:"c:\tfs\" so that there is only one workspace for all branches. This is mainly to avoid re-mapping problems that some of the developers had previously gotten themselves into. But I can't see how this would affect CI.
UPDATE: Ifound the answer indirectly; please read below

Ok I have found the answer myself after several dead ends. In the end I fixed this unintentionally while fixing another issue. Basically we had just turned on the automatic execution of unit tests for our builds. The test would run sucessfully but then immediately the build would bomb out with a message saying it was unable to report to the build drop folder.
What was happening was that while the Build service runs under one account and has a set of rights; some of the functionality is actually driven through the TFSService account. fter wading a heap of permissions I had my tests being reported. Then I noticed that builds had started to trigger on check-ins; I can't tell you exactly which permission fixed this but hopefully this answer will at least set people down the right path.
One other note a few of the builds started failing due to conflicting workspace mappings - this was a separate issue that I resolved by deleting some obsolete workspaces using the Attrice Sidekicks for Team Foundation tool.
Hope this helps somebody else.

Select your team project from team explorer, then right click on the Builds folder. Select a new build definition and then select the trigger tab. Move the radio button to "Build each check-in (more builds)"
More info can be found here
MSDN How to: Create a Build Definition

Are there any errors in the log on the TFS application server? Anything that indicates that it tried to fire but failed?

Related

Team foundation server's automated build is not getting the latest code

I have setup a build controller etc and the builds were failing, I have fixed these now and the build failed properly - as in because of an error.
I have fixed the error and checked the code back in but now the code is not being extracted, although sometimes one folder of many is.
I have deleted the code from the build machine and requeued a build but it keeps failing. It complains that it cannot find the solution that I specified as the build solution.
I have checked the check box to build even if nothing has changed.
Have I missed a setting somewhere for extracting the code?
TFS version is 2012 Express
Visual Studio version is 2010 Professional
I had this issue recently with TFS 2012. I think it boils down to this:
In the lastest build definition files, it appears that it performs a Clean task before updating the workspace. This means that if you do something that causes the Clean part of the build to fail, it will never download the new files in order to fix it.
Recently, I was making big changes to my build file and inevitably made a lot of mistakes, I found that if one of these mistakes caused the Clean to break, I had to go onto the Build server and change the file manually to get it working again.
Does this sound like it might be the same issue?
There are several properties in your build definition you can check. I would start with setting the "Clean Workspace" to All to ensure the correct code is being pulled down and built.
There are other checks you can look at as well like the agent set for the build and the "GetVersion" property. Check the below link out. It should be able to help you in more detail.
Define a Build Process that is Based on the Default Template

How to move builds done via Build Manager on Team Foundation Server to another server?

So, we're using continuous integration in our current Team Foundation Server 2010 setup, and so far it's working great. We're doing shelvesets, the build is running on the Build Manager in TFS, and it's also running our MSTest unit tests for us.
My question is, and I can't seem to find any information on this, is how to move the "build unit" that is created by the Build Manager on TFS to another server?
Aka, how do I "promote" this build to our QA, staging, etc... environments?
Before, we've were using VS2010's Publish Web feature, which allows us to set up publish "profiles", and each profile can have a different web.config related to it. This is really useful for anything we keep in our config files, like db connection strings, paths to app servers, etc... changing automatically based on our Publish Profile. We choose the profile, build locally, then use the "Publish" button to move the entire app to another server.
This setup worked great for when there were two of us working, and we were using TFS for just its source repository, but now the builds are happening on the TFS server.
What I'm looking for is a way for when TFS does the build for us (it's no longer being done locally on our machine, but by TFS Build Manager) to:
take into account which "publish profile" to use. This will effect what web.config is used and other items you can associate with a profile in your IDE.
once the build is created, to find a way to "push" the build to one of our other servers (QA, Staging, production) FROM TFS.
I don't even know if that is possible or not. Maybe it's still a manual job to take the build created on TFS, and copy it over by hand, and unzip the project/files into the correct file path on the deployed server? Or maybe it's part of the workflow in TFS, and I still have yet to find it.
This is surely possible already from TFS. Read the posts from Vishal Joshi on this topic, starting with: http://vishaljoshi.blogspot.com/2011/07/documenting-key-end-to-end-deployment.html
The solution I came up with is I wrote my own build handler for TFS, and use that code to push builds to our different environments. Here is the link I used to help me: http://geekswithblogs.net/jakob/archive/2010/10/27/devleoping-and-debugging-server-side-event-handlers-in-tfs-2010.aspx.
If anyone wants more specifics, just contact me and I'll be glad to help you.

How to target specific solutions in a TFS team build definition using WF?

Here is my situation.
I setup a build definition for continuous integration using the new workflow system. Then I targeted this definition to a particular solution. I checked-in my solution many times without a problem and the builds have all passed flawlessly on the server.
This morning, I notice that it has been executed but I did not checked-in the solution. I finally discover that when a colleague checked-in another solution, it executed the definition for the solution I am working on.
I am using the original ProcessTemplate.xaml file. I only want this build definition to be executed when I check-in a particular solution or a set of solution I chose. What do I miss here?
Thanks.
There are two things you need to do,
1. Edit build defination and click on the process tab, change the 'Items to Build' to the solution that you are interested to be build as part of your build.
2. Click on the workspace tab and point it only to the branch or specifically to the folder which logically excludes the solutions that you would like to exlude from this ci build.
Make sure you carry these steps across your build definations.
HTH.
Cheers, Tarun

What causes TFS to create additional workspaces?

I've seen the question related to the error message you get from TFS when a workspace is already mapped. The accepted answer for removing the workspace is alright as a workaround, but it's already getting tedious to run a delete command each time this error occurs.
What do I need to change in order to get out of having to use this workaround? I've got two builds (continuous integration and nightly deploy), and need to add at least one more build type. I followed this URL to see if there was a possible resolution there, but I'm not sure I understand it completely.
I am not sure how this is accomplished in TFS 2010, as I have not gotten to work with Team Build in 2010, yet. In 2008, though, if you expand the Builds node in the Team Project and right-right click on either of the builds, you will see a "Manage Build Agents..." option. Click into that, and it will bring up a dialog. One of the things on that dialog is an option called "Working Directory". Do you have the same hard-coded path in both of them?
By default, when you create a new build definition, it provides a calculated folder for this value. This is where the build agent will do the checkout from TFS for the build attempt. The default value is, $(Temp)\$(BuildDefinitionPath), I believe (I am not connected to TFS at the moment).
The article you link to is basically saying that you should include either that $(BuildDefinitionPath) value or the $(BuildDefinitionID) value as part of that path in that dialog so that the two builds do not try to use the same workspace. Changing the working folder to include one of those values should resolve your issue, going forward.

Changing the location of the TFS Build

I have a TFS Build Server where the CI and Release builds occur. The build process runs under some domain account and all the build activity happens under this user's temp directory. Unfortunately, the \Users directory is on the C: drive which turns out to have not much space. Although the build retention policy is quite strict, there are enough builds configured that this space has become quite scarce.
There are other volumes on the machine that have plenty of space.
Can anyone suggest a straightforward way to change the root build directory? I've looked for a TFS property without much success so far.
Thanks.
For TFS 2008 right click on the Builds node and chose "Manage Build Agents". Select the agent of choice and then press "Edit..." and change the working directory. My personal preference is to change it to something like:
c:\bw\$(BuildDefinitionId)
As that will give it a short working folder for your builds (the .NET API's have a 260 character limit for file paths so using as few of those characters as possible for your working folder gives you mor eto play with during your build).
For TFS 2005 edit the TFSBuild.proj file of the relevant build(s) and change the working property to point to where you want it for each build.
Hope that helps,
Martin.
In Team Explorer View,
Right-click Builds -> Manage Build Agents,
Select the build agent and hit 'Edit...'
Set 'Working directory' to
<New Build Root>\$(BuildDefinitionPath)
This works for all projects using that build agent.
My TFS proj files have a property called BuildDirectoryPath
<BuildDirectoryPath>c:\build</BuildDirectoryPath>
This is where all of my source code gets put and where the binaries are built.
Providing an answer for VS2012 / TFS2012 Server.
This will update the working directory on an agent-by-agent basis
- Team Explorer window
- Click Builds
- Click Actions and select Manage Build Controllers
- For each Agent, click Properties and click inside the working directory field and change it, clicking OK when you are done
Note: the OP talked about a domain account and the temp folder. Therefore, this solution may not work for the OP but it did work in my case to move from the System (C) drive to an alternative volume (D in our case).

Resources