简体   繁体   中英

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?

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM