Thanks to the hard work of the puppet-openstack
community, Puppet was the preferred method of deployment for Openstack
in the latest Openstack User Survey.
If you’d like to join in on the fun and contribute, read on !
First things first, a bit of context:
Now that we have the basics out of the way, if you’d like to contribute
to Openstack in general, it’s not mandatory to have any programming or
networking knowledge. There’s always things like documentation and
translation that need manpower.
For contributing to puppet-openstack in particular, however, it is
required to be (or become!) familiar with ruby, puppet,
puppet-rspec and of course, Openstack..
The contribution process for puppet-openstack is slightly different than
committing code to primary Openstack projects (such as Nova) and I won’t
be highlighting them here for the sake of simplicity – this is a topic
for another blog post !
I recently started contributing as part of the
new puppet-ceph initiative so this blog post more or less describes
what I had to go through to get my first contribution in.
If you want to join in on the fun, the basic instructions for signing up
are pretty well documented on the Openstack
Wiki: https://wiki.openstack.org/wiki/How_To_Contribute
In a nutshell:
Let’s say I want to develop for puppet-ceph (!), I’ll keep these
resources handy:
You’re going to need the puppet module source to work on it, you can
either clone it from Github:
git clone https://github.com/stackforge/puppet-ceph
or from Gerrit:
git clone https://review.openstack.org/stackforge/puppet-ceph
First of all, you’ll need ruby and bundle to manage ruby
packages (gems).
These will be required, especially when the time will come to do
spec/integration/lint tests.
If you already have them you can skip this part !
On Ubuntu:
apt-get install ruby rubygems ruby-bundler
On Debian:
apt-get install ruby rubygems bundler
With the help of bundle, fetch and install the gem dependencies
documented in the Gemfile located at the root of the repository.
bundle install
Create a branch with a name relevant to what you’re doing
git checkout -b feature/my_feature
Now you can do your modifications.
Don’t forget to add new spec tests or modify existing ones to match the
modifications you made to the module.
You’ve added or modified some code, now you want to test it:
Test for puppet syntax (puppet-lint):
bundle exec rake lint
Run spec tests (puppet-rspec)
bundle exec rake spec
If you try to push code that doesn’t pass the tests, jenkins will not
let you through – better make sure everything is okay before sending
something for review!
git add [file] git commit
Make sure your commit message follows the right format !
git review
That’s it ! Your code was sent to gerrit for review by the community
and the core reviewers !
Maybe you did a typo or something far worse you’d like to fix – this is
done by submitting another patch set.
Do the changes you want to do, add the files again but instead of using
‘git commit‘, use ‘git commit —amend‘.
This will essentially modify the initial commit.
After amending your commit, send the code back for a new review with
‘git review‘ once more.