3

Our development departments grows and I want to force a stable master/trunk.

Up to now every developer can commit into the master/trunk. In future developers should commit into a staging area, and if all tests pass the code gets moved to the trunk automatically. If the test fails, the developer gets a mail with the failed tests.

We have several repositories: One for the core product, several plugins and a repository for every customer.

Up to now we run SVN and git, but switching all repos to git could be done, if necessary.

Which software could help us to get this done?

There a some articles on the web which explain how to use gerrit and jenkins to force a stable branch.

I am unsure if I need both, or if it is better to use something else.

Environment: We are 10 developers, and use python and django.

Question: Which tool can help me to force a stable master branch?

Update

I was on holiday, and now the bounty has expired. I am sorry. Thank you for your answers.

guettli
  • 25,042
  • 81
  • 346
  • 663

3 Answers3

2

Question: Which tool can help me to force a stable master branch?

Having been researching this particular aspect of CI quasi-pathologically since our ~20 person PHP/ZF1-based dev team made the switch from SVN to Git over the winter (and I became the de-facto git mess-fixer), I can't help but share my experience with this particular aspect of continuous integration.

While obviously, having a "critical mass of unit tests running" in combination with a slew of conditionally parameterized Jenkins jobs, triggering infinitely more conditionally parameterized jobs, covering every imaginable circumstance would (perhaps) be the best and most proper way to move towards a Continuous Integration/Delivery/Deployment model, the meatspace resources required for such a migration are not insignificant.

Some questions:

  • Does your team have some kind of VCS workflow or, minimally, rules defined?

  • What percentage would you say, roughly, of your codebase is under some kind of behavioral (eg. selenium), functional or unit testing?

  • Does your team ( / senior devs ) actually have the time / interest to get the most out of gerrit's peer-based code review functionality?

  • On average, how many times do you deploy to production in any given day / week / month?

If the answers to more than one of these questions are 'no', 'none', or 'very little/few', then I'd perhaps consider investing in some whiteboard time to think through your team's general workflow before throwing Jenkins into the mix.

Also, git-hooks. Seriously.

However, if you're super keen on having a CI/Jenkins server, or you have all those basics covered already, then I'd point you to this truly remarkable gem of a blog post:

And it's equally savvy cousin:

Oh, and of course, the very necessary devopsreactions tumblr.

  • Here the answers: - We have strict rules how to get the code from VCS the testing and production servers. But only a small check script (to avoid unicode errors) how to get code into the VCS. - about 80% of the code are tested by unittests. - We deploy about 2 times per week. – guettli Jul 31 '13 at 06:11
1

There a some articles on the web which explain how to use gerrit and jenkins to force a stable branch.

I am unsure if I need both, or if it is better to use something else.

  • gerrit is for coding review
  • Jenkins is a job scheduler that can run any job you want, including one:
    • compiling everything
    • launching sole unit test.

In each case, the idea is to do some guarded commit, ie pushing to an intermediate repo (gerrit, or one monitored by Jenkins), and only push to the final repo if the intermediate process (review or automatic build/test) passed successfully.

By adding intermediate repos, you can easily force one unique branch on the final "blessed" repo to which those intermediate referential will push to if the commits are deemed worthy.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

It sounds like you are looking to establish a standard CI capability. You will need the following essential tools:

  • Source Version Control : SVN, git (You are already covered here)
  • CI server : Jenkins (you will need to build and run tests with each check in, and report results. Jenkins is the defacto standard tool
    used for this)
  • Testing : PyUnit
  • Artifact Repository : you will need a mechanism for organizing and archiving the increments created with each build. This could be a simple home grown directory based system. I have also used Archiva, but there are other tools.

There are many additional tools that might be useful depending on your development process:

  • Code review : If you want to make code review a formal gate in your process, Gerrit is a good tool.
  • Code coverage analysis : I've used EMMA in the past for Java. I am sure that are some good tools for Python coverage.
  • Many others : a library of Jenkin's plugins that provide a variety of useful tools is available to you. Taking some time to review available plugins will definitely be time well spent.

In my experience, establishing the right cultural is as important as finding the right tooling.

  • Testing : one of the 10 principles of CI is "self testing builds". In other words, you must have a critical mass of unit tests running. Developers must become test infected. Unit testing must become a natural, highly value part of each developers individual development process. In my experience, establishing a culture of test infection is the hardest part of deploying CI.
  • Frequent check-in : Developers and managers must organize there work in a way that allows for frequent small check-ins. CI calls for daily checkins. This is sometimes a difficult habit to establish.
  • Responsiveness to feedback : CI is about immediate feedback. The developers must be conditioned to response to the immediate feedback. If unit tests fail, the build it broken. Within 15 minutes of a CI build breaking, the developer responsible should either have a fix checked in, or have the original, bad check-in backed out.