views:

65

answers:

4

I've just started working in a continuous integration environment (TeamCity). I understand the basic idea of not getting so abstracted out in your code that you are never able to build it to test functionality, etc. However, when there is deep coding going on, occasionally it will take me several days to get buildable code--but in the interim other team members may need to see my code.

If I check the code in, it breaks the build. However, if I don't check it in, my team members are unable to see the most recent work. I'm wondering how this situation is best dealt with.

+4  A: 

A tool like Code Collaborator (Google link, smartbear.com is down..) would allow your peers to see your code, without you committing it. Instead, you just submit it for review.

It's a little extra trouble for them to run it though.

Alternatively, setup a second branch/fork of your codebase for you to work in, your peers can sync to that, and it won't break the build server. When you're done working in your own branch, you can merge it back with mainline/trunk/whatever.

Dolph
+1 for branching advice.
Leigh Shayler
+1  A: 

In a team environment, it is usually highly undesirable for anybody to be in an unbuildable state for days. I try to break large code deliveries to as many buildable check-ins as I can. At minimum, create and check in your interfaces even if you do not have the implementation ready so others can start to code against them.

Jim Anderson
Why precisely would it be undesirable?
alchemical
@LuftMensch The longer anybody cannot check in their code due to not being able to the build, the 'staler' the application becomes. Code gets out of sync and eventual code merges become more complex and error prone.
Jim Anderson
hmmm, ok, I'll ponder that.
alchemical
A: 

One of the primary benefits of Continuous Integration is that it shows you when things break and when things are fixed. If you commit those pieces of code that break the system, other developers will be forced to get it into a working state before continuing the development. This is a good thing because it doesn't allow code changes to be made on top of broken things (which could cause issues where a co-workers code worked on the broken system, but doesn't work once the initial break is fixed).

This is also a prime example of a good time to use branches/forks, and simply merge to the trunk when all the broken things are fixed.

Mike Trpcic
I'm not sure I agree with the comment that it 'forces others to fix it' - surely the point is that if you break it you fix it?
Klelky
A: 

I am in exactly the same situation here.. As build engineer I have this working beautifully.

First of all, let me break down the branches / projects. @Dolph Mathews has already mentioned branching and tbh, that is an essential part of getting your setup to work.

  • Take the main code base and integrate it into several personal or "smaller" team branches. i.e. branch_team_a, branch_team_b, branch_team_c
  • Then set up teamcity to build against these branches under different project headings. So you will eventually have the following: Project Main, Project Team A, Project Team B, Project Team C
  • Thirdly, then setup developer checkins so that they run pre-commits builds for the broken down branches.. You can find the TC plugin for this under tools and settings.. They have it for IntelliJ or VS.

You now have your 3-tier setup.. - Developer kick starts a remote-run pre-commit build from their desktop against their project. If it passes, it get's checked into the repository i.e. branch_team_a - Project Team A passes after several check-ins; at which point you integrate your changes from branch_team_A to main branch - Project Main builds!

If all is successful then you have a candidate release.. If one part fails, projects a, b or c. it doesn't get checked into main. This has been my tried and tested method and works everytime. It also vastly improves team communication.