|
Packit |
bc9a3a |
*********************
|
|
Packit |
bc9a3a |
Hacking on cloud-init
|
|
Packit |
bc9a3a |
*********************
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
This document describes how to contribute changes to cloud-init.
|
|
Packit |
bc9a3a |
It assumes you have a `GitHub`_ account, and refers to your GitHub user
|
|
Packit |
bc9a3a |
as ``GH_USER`` throughout.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Do these things once
|
|
Packit |
bc9a3a |
====================
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* To contribute, you must sign the Canonical `contributor license agreement`_
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
If you have already signed it as an individual, your Launchpad user will be
|
|
Packit |
bc9a3a |
listed in the `contributor-agreement-canonical`_ group. Unfortunately there
|
|
Packit |
bc9a3a |
is no easy way to check if an organization or company you are doing work for
|
|
Packit |
bc9a3a |
has signed. When signing the CLA and prompted for 'Project contact' or
|
|
Packit |
bc9a3a |
'Canonical Project Manager' enter 'Josh Powers'.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
For existing contributors who've already signed the agreement, we can verify
|
|
Packit |
bc9a3a |
the link between your `Launchpad`_ account and your `GitHub`_ account by
|
|
Packit |
bc9a3a |
creating a branch with both your Launchpad and GitHub usernames into both
|
|
Packit |
bc9a3a |
Launchpad and GitHub cloud-init repositories. We've added a tool
|
|
Packit |
bc9a3a |
(tools/migrate-lp-user-to-github) to the cloud-init repository to handle this
|
|
Packit |
bc9a3a |
migration as automatically as possible.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
The cloud-init team will review the two merge proposals and verify
|
|
Packit |
bc9a3a |
that the CLA has been signed for the Launchpad user and record the
|
|
Packit |
bc9a3a |
associated GitHub account. We will reply to the email address
|
|
Packit |
bc9a3a |
associated with your Launchpad account that you've been clear to
|
|
Packit |
bc9a3a |
contribute to cloud-init on GitHub.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
If your company has signed the CLA for you, please contact us to help
|
|
Packit |
bc9a3a |
in verifying which launchad/GitHub accounts are associated with the
|
|
Packit |
bc9a3a |
company. For any questions or help with the process, please email:
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
`Josh Powers <mailto:josh.powers@canonical.com>`_ with the subject: Cloud-Init CLA
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
You also may contanct user ``powersj`` in ``#cloud-init`` channel via IRC freenode.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Configure git with your email and name for commit messages.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Your name will appear in commit messages and will also be used in
|
|
Packit |
bc9a3a |
changelogs or release notes. Give yourself credit!::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
git config user.name "Your Name"
|
|
Packit |
bc9a3a |
git config user.email "Your Email"
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Sign into your `GitHub`_ account
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Fork the upstream `repository`_ on Github and clicking on the ``Fork`` button
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Create a new remote pointing to your personal GitHub repository.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
.. code:: sh
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
git clone git://github.com/canonical/cloud-init
|
|
Packit |
bc9a3a |
cd cloud-init
|
|
Packit |
bc9a3a |
git remote add GH_USER git@github.com:GH_USER/cloud-init.git
|
|
Packit |
bc9a3a |
git push GH_USER master
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
.. _GitHub: https://github.com
|
|
Packit |
bc9a3a |
.. _Launchpad: https://launchpad.net
|
|
Packit |
bc9a3a |
.. _repository: https://github.com/canonical/cloud-init
|
|
Packit |
bc9a3a |
.. _contributor license agreement: http://www.canonical.com/contributors
|
|
Packit |
bc9a3a |
.. _contributor-agreement-canonical: https://launchpad.net/%7Econtributor-agreement-canonical/+members
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Do these things for each feature or bug
|
|
Packit |
bc9a3a |
=======================================
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Create a new topic branch for your work::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
git checkout -b my-topic-branch
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Make and commit your changes (note, you can make multiple commits,
|
|
Packit |
bc9a3a |
fixes, more commits.)::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
git commit
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Run unit tests and lint/formatting checks with `tox`_::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
tox
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Push your changes to your personal GitHub repository::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
git push -u GH_USER my-topic-branch
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Use your browser to create a merge request:
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
- Open the branch on GitHub
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
- You can see a web view of your repository and navigate to the branch at:
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
``https://github.com/GH_USER/cloud-init/tree/my-topic-branch``
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
- Click 'Pull Request`
|
|
Packit |
bc9a3a |
- Fill out the pull request title, summarizing the change and a longer
|
|
Packit |
bc9a3a |
message indicating important details about the changes included, like ::
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Activate the frobnicator.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
The frobnicator was previously inactive and now runs by default.
|
|
Packit |
bc9a3a |
This may save the world some day. Then, list the bugs you fixed
|
|
Packit |
bc9a3a |
as footers with syntax as shown here.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
The commit message should be one summary line of less than
|
|
Packit |
bc9a3a |
74 characters followed by a blank line, and then one or more
|
|
Packit |
bc9a3a |
paragraphs describing the change and why it was needed.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
This is the message that will be used on the commit when it
|
|
Packit |
bc9a3a |
is sqaushed and merged into trunk.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
LP: #1
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Note that the project continues to use LP: #NNNNN format for closing
|
|
Packit |
bc9a3a |
launchpad bugs rather than GitHub Issues.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
- Click 'Create Pull Request`
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Then, someone in the `Ubuntu Server`_ team will review your changes and
|
|
Packit |
bc9a3a |
follow up in the pull request.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Feel free to ping and/or join ``#cloud-init`` on freenode irc if you
|
|
Packit |
bc9a3a |
have any questions.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
.. _tox: https://tox.readthedocs.io/en/latest/
|
|
Packit |
bc9a3a |
.. _Ubuntu Server: https://github.com/orgs/canonical/teams/ubuntu-server
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Design
|
|
Packit |
bc9a3a |
======
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
This section captures design decisions that are helpful to know when
|
|
Packit |
bc9a3a |
hacking on cloud-init.
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
Cloud Config Modules
|
|
Packit |
bc9a3a |
--------------------
|
|
Packit |
bc9a3a |
|
|
Packit |
bc9a3a |
* Any new modules should use underscores in any new config options and not
|
|
Packit |
bc9a3a |
hyphens (e.g. `new_option` and *not* `new-option`).
|