Thursday 15 March 2012

The real way to start hacking on OpenStack

I've seen recent attempts at blog posts to show how to get started at hacking on an OpenStack project.  Unfortunately they seem to have over-complicated the issue for new users.  As part of the Core Infrastructure team it is my job to make submitting, reviewing and merging code easier for developers.  This includes documenting that process, so here goes :)

  1. You need a Launchpad account and need to be joined to the Openstack team.  You can also join the team of one of the many subprojects if you want to.  Make sure Launchpad has your SSH key, Gerrit (the code review system) uses this.
  2. Sign the CLA as outlined in section 3 of the How To Contribute wiki page
  3. Tell git your details:
    git config --global user.name "Firstname Lastname"
    git config --global user.email "your_email@youremail.com" 
  4. Install git-review. This tool takes a lot of the pain out of remembering commands to push code up to Gerrit for review and to pull it back down to edit it. It is installed using:
    pip install git-review
    Several Linux distributions (notably Fedora 16 and Ubuntu 12.04) are also starting to include git-review in their repositories so it can also be installed using the standard package manager.
  5. Grab a tree to hack on, for example for Nova you would do:
    git clone git://github.com/openstack/nova.git
  6. Checkout a new branch to hack on:
    git checkout -b TOPIC-BRANCH
  7. Start hacking
  8. Run the test suite locally to make sure nothing broke
  9. Commit your work using:
    git commit -a
    or you can use the following to edit a previous commit:
    git commit -a --amend
  10. Push the commit up for code review using:
    git review
    That is the awesome tool we installed earlier that does a lot of hard work for you
  11. Watch your email or review site, it will automatically send your code for a battery of tests on our Jenkins setup and the core team for the project will review your code. If there is any changes that should be made they will let you know.
  12. When all is good the review site will automatically merge your code
Obviously nearly half of that list are tasks you will only need to perform once. So as you can see it is pretty darn simple to get started. If anyone gets stuck they are welcome to shout out in the #openstack-dev IRC channel or the OpenStack mailing list. For more information on developer work flow please see the Gerrit Workflow page, I'm not ashamed to say I still have it as a pinned tab :)

2 comments:

  1. So you use launchpad but then use Git? What happened?

    ReplyDelete
    Replies
    1. I don't know the full history of it, but Openstack switched from bzr to git a while back. We still use Launchpad for SSO and bug tracking. Monty will know the history as to why we switched. In my opinion git appears to be a lot better at most things.

      Compared to the way we do things in Drizzle the big plus is testing and merging is completely automated.

      Delete

Note: only a member of this blog may post a comment.