CONTRIBUTING.md 11.5 KB
Newer Older
Tomek Mrugalski's avatar
Tomek Mrugalski committed
1
# ISC DHCP Contributor's Guide
Tomek Mrugalski's avatar
Tomek Mrugalski committed
2

Tomek Mrugalski's avatar
Tomek Mrugalski committed
3 4
So you found a bug in ISC DHCP or plan to develop an extension and want to send us a patch? Great!
This page will explain how to contribute your changes smoothly.
Tomek Mrugalski's avatar
Tomek Mrugalski committed
5

Thomas Markwalder's avatar
Thomas Markwalder committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
We do not require a contributors agreement. By submitting a patch or merge request to this project,
you are agreeing that your code will be covered by the primary license for the project.
ISC DHCP is currently licensed under the MPL2.0 license.

Here's are the steps in contributing a patch:

1. **create account** on [gitlab](https://gitlab.isc.org)
2. **open an issue** in [this project](https://gitlab.isc.org/isc-projects/dhcp/issues/new), make sure
   it describes what you want to fix and **why**. ISC DHCP is very mature code, with a large installed base.
   We are fairly conservative about making changes unless there is a very good reason.
3. **ask someone from the ISC team to give you a 'project allocation' so you can to fork ISC DHCP in our repo** (ask on the issue - mention @tomek, @vicky, @ondrej
   or @godfryd if it seems we haven't noticed your request)
4. **fork the DHCP master branch**: go to the DHCP project page, click the [Fork button](https://gitlab.isc.org/isc-projects/dhcp/forks/new).
   If you can't, you didn't complete step 3. It helps to include the issue number and subject in the branch name.
5. **Implement your fix or feature, in your branch**. Make sure it compiles, has unit-tests,
   is documented and does what it's supposed to do.
6. **Open Merge Request**: go to the DHCP project [merge requests page](https://gitlab.isc.org/isc-projects/dhcp/merge_requests), and
   click [New merge request](https://gitlab.isc.org/isc-projects/dhcp/merge_requests/new). If you
   don't see the button, you didn't complete step 3.
7. **Participate in the code review**: Once you submit the MR, someone from ISC will eventually get
   to the issue and will review your code. Please make sure you respond to comments. It's likely
   you'll be asked to update the code.

See the text below for more details.


## Create an issue

The first step in contributing to ISC DHCP is to [create an issue](https://gitlab.isc.org/isc-projects/dhcp/issues/new), describing the problem, deficiency
or missing feature you want to address.  It is important to make it very clear why the specific change
you are proposing should be made. ISC DHCP is very mature code, with a large and somewhat inert installed base.
We are very cautious about introducing changes that could break existing functionalty.  If you want to fix
multiple problems, or make multiple changes, please make separate issues for each.

## Plan your changes
Tomek Mrugalski's avatar
Tomek Mrugalski committed
41

Tomek Mrugalski's avatar
Tomek Mrugalski committed
42
Before you start working on a patch or a new feature, it is a good idea to discuss it first with
Thomas Markwalder's avatar
Thomas Markwalder committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
DHCP developers.  You may benefit from reading the [ISC DHCP Developer's Survival Guide](https://gitlab.isc.org/isc-projects/dhcp/wikis/home)
posted on the wiki page for this repo.

You can post questions about development on the [dhcp-workers](https://lists.isc.org/mailman/listinfo/dhcp-workers)
or [dhcp-users](https://lists.isc.org/mailman/listinfo/dhcp-users) mailing lists. Dhcp-users is
intended for users who are not interested in development details: it is appropriate to ask for
feedback regarding the best proposed solution to a certain problem. The internal details,
questions about the code and its internals are better asked  on dhcp-workers. The dhcp-workers
list is a very low traffic list.


## Create a branch for your work

These instructions assume you will be making your changes on a branch in the ISC DHCP Gitlab
repository. This is by far the easiest way for us to collaborate with you.  While we also maintain a presence
on [Github](https://github.com/isc-projects/dhcp), ISC developers rarely look at Github, which is
just a mirror of our Gitlab system.

ISC's Gitlab has been a target for spammers, so it is set up defensively. New users need permission
from ISC to create new projects.  We gladly do this for anyone who asks and provides a good reason.
"I'd like to fix bug X or develop feature Y" is an excellent reason. To request a project
allocation in ISC's Gitlab, just ask for it in a comment in your issue. Make sure
you tag someone at ISC (@tomek, @godfryd, @vicky or @ondrej). When you write a comment in an issue or
merge request and add a name tag on it, the user is automatically notified.

Once you are given a 'project allocation' in our Gitlab, you can fork ISC DHCP and create a branch.
This is your copy of ISC DHCP and is where you will make your changes. Go to the DHCP project page,
click the [Fork button](https://gitlab.isc.org/isc-projects/dhcp/forks/new) and you will be prompted
to name your branch. It helps to include the issue number and subject in the branch name. You can make
changes to this branch without worrying that you will impact the master branch - commit priviliges
are restricted so you cannot accidentally alter the master branch.

Please read the [Gitlab How-To](https://gitlab.isc.org/isc-projects/dhcp/wikis/processes/gitlab-howto) for ISC DHCP.


## Implement your change

Please try to conform to the project's coding standards. ISC DHCP uses the same [coding standards](https://gitlab.isc.org/isc-projects/bind9/blob/master/doc/dev/style.md) as the BIND 9 project. https://gitlab.isc.org/isc-projects/bind9/blob/master/doc/dev/style.md


## Compile your code

We don't yet have continuous integration set up for ISC DHCP, so you have to check the compilation manually.
ISC DHCP is used on a wide array of UNIX and Linux operating systems. Will your code compile and work there?
What about endianness? It is likely that you used a regular x86 architecture machine to write your
patch, but the software is expected to run on many other architectures. .

## Run unit-tests
Tomek Mrugalski's avatar
Tomek Mrugalski committed
91

Tomek Mrugalski's avatar
Tomek Mrugalski committed
92
One of the ground rules in all ISC projects is that every piece of code has to be tested. For newer
Thomas Markwalder's avatar
Thomas Markwalder committed
93
projects, we require a unit-test for almost every line of code. For older code, such as
Tomek Mrugalski's avatar
Tomek Mrugalski committed
94 95 96 97
ISC DHCP, that was not developed with testability in mind, it's unfortunately impractical to require
extensive unit-tests. Having said that, please think thoroughly if there is any way to develop
unit-tests. The long term goal is to improve the situation.

Thomas Markwalder's avatar
Thomas Markwalder committed
98 99 100 101
Where unit tests are not practical, supplying us with things like configuration file(s), lease file(s),
PCAPS, and step-by-step on how you tested the changes would be a big help.  This will aid us in
creating and adding system tests to the build farm.

Tomek Mrugalski's avatar
Tomek Mrugalski committed
102 103 104 105 106 107 108 109
You should have also conducted some sort of system testing to verify that your changes do what you
want. It would be extremely helpful if you can attach any configuration files (dhcpd and or
dhclient), along with a step-by-step procedure to carry out the test(s).  This will help us verify
your changes as extend our own system tests.

Make sure you have ATF (Automated Test Framework) installed in your system. For more information
about ATF, please refer to <dhcp source tree>/doc/devel/atf.dox.  Note, running "make devel" in this
directory will generate the documentation. To run the unit-tests, simply run:
Tomek Mrugalski's avatar
Tomek Mrugalski committed
110 111

```bash
Thomas Markwalder's avatar
Thomas Markwalder committed
112 113
./configure --with-atf
make
Tomek Mrugalski's avatar
Tomek Mrugalski committed
114 115 116 117 118
make check
```

If you happen to add new files or have modified any Makefile.am files, it is also a good idea to
check if you haven't broken the distribution process:
Tomek Mrugalski's avatar
Tomek Mrugalski committed
119 120 121 122 123

```bash
make distcheck
```

Tomek Mrugalski's avatar
Tomek Mrugalski committed
124 125
There are other useful switches which can be passed to configure. A complete list of all switches
can be obtained with the command:
Tomek Mrugalski's avatar
Tomek Mrugalski committed
126 127 128 129 130

```bash
./configure --help
```

Thomas Markwalder's avatar
Thomas Markwalder committed
131
## Create a Merge Request
Tomek Mrugalski's avatar
Tomek Mrugalski committed
132

Thomas Markwalder's avatar
Thomas Markwalder committed
133
Once you feel that your patch is ready, go to the DHCP project
Tomek Mrugalski's avatar
Tomek Mrugalski committed
134
and [submit a Merge Request](https://gitlab.isc.org/isc-projects/dhcp/merge_requests/new).
Tomek Mrugalski's avatar
Tomek Mrugalski committed
135

Thomas Markwalder's avatar
Thomas Markwalder committed
136 137 138
If you can't access this link or don't see New Merge Request button on the [merge requests
page](https://gitlab.isc.org/isc-projects/dhcp/merge_requests), please ask on dhcp-workers and someone
will help you out.
Tomek Mrugalski's avatar
Tomek Mrugalski committed
139

Tomek Mrugalski's avatar
Tomek Mrugalski committed
140 141
Once you submit it, someone from the DHCP development team will look at it and will get back to you.
The dev team is very small, so it may take a while...
Tomek Mrugalski's avatar
Tomek Mrugalski committed
142

Thomas Markwalder's avatar
Thomas Markwalder committed
143
## If you really can't do a merge request on ISC's Gitlab...
Tomek Mrugalski's avatar
Tomek Mrugalski committed
144

Tomek Mrugalski's avatar
Tomek Mrugalski committed
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
Well, you are out of luck. There are other ways, but those are really awkward and the chances of
your patch being ignored are really high. Anyway, here they are:

- Create a ticket in the DHCP Gitlab (https://gitlab.isc.org/isc-projects/dhcp) and attach your
  patch to it. Sending a patch has a number of disadvantages. First, if you don't specify the base
  version against which it was created, one of ISC engineers will have to guess that or go through
  a series of trials and errors to find that out. If the code doesn't compile, the reviewer will not
  know if the patch is broken or maybe it was applied to incorrect base code. Another frequent
  problem is that it may be possible that the patch didn't include any new files you have added.

- Send a patch to the dhcp-workers list. This is even worse, but still better than not getting the
  patch at all. The problem with this approach is that we don't know which version the patch was
  created against and there is no way to track it. So the chances of it being forgotten are high.
  Once a DHCP developer get to it, the first thing he/she will have to do is try to apply your
  patch, create a branch commit your changes and then open MR for it.

## Going through a review
Tomek Mrugalski's avatar
Tomek Mrugalski committed
162

Thomas Markwalder's avatar
Thomas Markwalder committed
163 164 165 166 167 168
Once the merge request (MR) is in the system, the action is on one of the core developers.

Sooner or later, one of these engineers will do the review. Unfortunately, we have a small team
and we have a lot of users to support, so it may take a while for us to get to your patch.
Having said that, we value external contributions very much and will do whatever we
can to review patches in a timely manner.
Tomek Mrugalski's avatar
Tomek Mrugalski committed
169

Thomas Markwalder's avatar
Thomas Markwalder committed
170 171 172 173 174 175
Don't get discouraged if your patch is not accepted on the first review. To keep the code
quality high, we use the same review processes for external patches as we do for internal code.
It may take some cycles of review/updated patch submissions before the code is finally accepted.
The nature of the review process is that it emphasizes areas that need improvement. If you are
not used to the review process, you may get the impression that the feedback is negative. It
is not: even the core developers seldom see reviews that say "All OK please merge".
Tomek Mrugalski's avatar
Tomek Mrugalski committed
176 177

If we happen to have any comments that you as submitter are expected to address (and in the
Thomas Markwalder's avatar
Thomas Markwalder committed
178 179
overwhelming majority of cases, we have), you will be asked to update your MR. It is common
to see several rounds of such reviews.
Tomek Mrugalski's avatar
Tomek Mrugalski committed
180 181 182 183 184 185 186 187 188 189

Once the process is almost complete, the developer will likely ask you how you would like to be
credited. The typical answers are by first and last name, by nickname, by company name or
anonymously. Typically we will add a note to the ChangeLog and also set you as the author of the
commit applying the patch and update the contributors section in the AUTHORS file. If the
contributed feature is big or critical for whatever reason, it may also be mentioned in release
notes.

Sadly, we sometimes see patches that are submitted and then the submitter never responds to our
comments or requests for an updated patch. Depending on the nature of the patch, we may either fix
Thomas Markwalder's avatar
Thomas Markwalder committed
190
the outstanding issues on our own and get another engineer to review them or the ticket may end
Tomek Mrugalski's avatar
Tomek Mrugalski committed
191 192 193
up in our Outstanding milestone. When a new release is started, we go through the tickets in
Outstanding, select a small number of them and move them to whatever the current milestone is. Keep
that in mind if you plan to submit a patch and forget about it. We may accept it eventually, but
Thomas Markwalder's avatar
Thomas Markwalder committed
194
it's a much, much faster process if you participate in it.
Tomek Mrugalski's avatar
Tomek Mrugalski committed
195

Thomas Markwalder's avatar
Thomas Markwalder committed
196
#### Thank you for contributing your time and expertise to the ISC DHCP Project.