user967710
user967710

Reputation: 2007

GIT & Jenkins - how to dilemma

I am migrating from clearcase to GIT. In clearcase I had the "checkout" feature on files, which indicated work on that file and prevented others (on the stream) from editing the file, and avoided merging. Now, in GIT we are experiencing a lot of merging which is OK, but I wanted to ease the merges using CI.

This is what I had in mind:

  1. Every day at 2:00 am, I will go over the list of computers in the team - and access the GIT repositories, and launch git push --force origin {user_name} (That is, create a branch for every user)
  2. Then, I will perform merges between the different branches and if there are non-trivial merges, I shall create a report alerting the possibility.
  3. If there is no problem with the merge, I will build and make sure there are no compilation problems and may also run some tests.

However, I know that the common practice is to hook the commit and run a CI process at that time.

GIT maintains almost everything locally and avoids server side calls, and I fill that hooking the git commit to the CI process undermines this advantage of GIT.

So, a few questions:

  1. What sort of practices/approaches are common in CI with GIT?
  2. Where can I read more about real-life implementations of different GIT & CI approaches.
  3. Which is most widely spread and what are its advantages over the other approaches?

Thank you

Upvotes: 0

Views: 92

Answers (2)

bemagee
bemagee

Reputation: 3

My suggestion is to purchase the book: Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) - Humble, Jez, Farley, David

The book outlines a good process and framework for continuous integration. I believe that the responsibility is on your Developers to ensure that the code compiles, merges and passes high level functional test BEFORE they commit to the main branch which triggers the automated build. The Developers also need to commit to fix any issues with the automated build output IMMEDIATELY. Your CI tool set needs to communicate the status of the automated builds and tests and Management needs to ensure that failures are the highest priority for the Development teams to fix.

Upvotes: 0

michas
michas

Reputation: 26555

I seems like you are trying to emulate the old clearcase induced workflow by means of git. This is usually not a good idea. (Even though your team is used to the good old workflow.)

If clearcase works fine for you, just stick with clearcase. If you had a good reason to switch to git, use the chance to look at you business workflows and build a suitable git workflow around it.

Ask yourself some questions:

  • What kind of files are you working with? (code, documentation, ...)
  • Why do you need to change the files at all? (new features, bug fixes, ...)
  • Why do different team members need to work on the same files? (Maybe you could improve the assignment of your tasks or the structure of your project?)

Next set up some meaningful branches. Currently it seems like you are doing all your work on one single master branch, but branches in git are extremely lightweight you really should think about developing features in separate branches and do explicit merges.

Please don't abuse your CI system to push commits around and enforce automatic merges unless you have a very good reason for this. A "push" usually means, you have finished your work and are ready to share it with your other team members. Your CI system usually cannot decide whether the work is finished or in some buggy experimental state.

I would recommend setting up a some branches, give them a good semantic and set up you CI system to check those branches whenever they are updated. - Things like push and merge should always be done explicitly and intentional by a real person. Otherwise strange things will happen, sooner or later.

But all of this depends on your specific situation. There is no recipe which works for everyone.

Upvotes: 3

Related Questions