kkwak
kkwak

Reputation: 41

How can I integrate git and svn for TeamCity?

Currently:

  1. TeamCity is setup to build from SVN.
  2. TeamCity is setup to build from GIT.
    • Git bare repo on the TC server (not on agent)

I'm manually (from my repo, which has the svn ref) rebasing (git spull - standard alias) and checking in to the bare git repo on the TC server (git push).

As we're in the process of migrating to git (assuming we can figure out how!) we have checkins from both svn and git.

One thing to note is that the svn repo will need to be updated even after everyone stops checking in to it per company policy. (So after a successful build, we'll trigger a "git spush")

What would be the setup for TeamCity?

  1. Worst case scenario is that I manually pull from svn (until everyone is off svn) and rebase the bare git repo. This would continue after everyone has migrated, per company policy described above
  2. Another way might be to add the svn ref to the bare repo and write a script that will call "git spull" every hour or so via TC.
    • Could be trouble if there are merge conflicts
    • Will also need another config that will "git spush" after a successful build
  3. Yet another way, might be to have a svn plugin to trigger the "svn spull" after every checkin in svn and drop that off in a special branch with a manual merge step (slightly better than option 1 and removes the worst case for option 2)

Any other ways? Anyone doing something similar?

Upvotes: 3

Views: 1368

Answers (2)

kkwak
kkwak

Reputation: 41

Darn it, I wish I found this blog earlier!

http://www.tfnico.com/presentations/git-and-subversion

I've come to similar conclusions, but wasted 5-6 hours.

Upvotes: 1

alastairs
alastairs

Reputation: 6805

First, I would be very interested to read how you accomplished your migration once it's completed. A blog post or something writing up your experiences, documenting the problems you hit, would be a fantastic resource. I'm thinking of starting the same migration at my place of work.

I think option 2 sounds most sensible, but I'm not sure why you would need to set up a pull operation as well as a push. Why not just continue with the successful builds being pushed to SVN to keep that in sync with Git?

Upvotes: 0

Related Questions