]> git.ipfire.org Git - thirdparty/dhcp.git/blob - CONTRIBUTING.md
Update CONTRIBUTING.md
[thirdparty/dhcp.git] / CONTRIBUTING.md
1 # Kea Contributor's Guide
2
3 So you found a bug in Kea or plan to develop an extension and want to send us a patch? Great! This
4 page will explain how to contribute your changes smoothly.
5
6 ## Writing a patch
7
8 Before you start working on a patch or a new feature, it is a good idea to discuss it first with
9 DHCP developers. You can post your questions to the [dhcp-workers](https://lists.isc.org/mailman/listinfo/dhcp-workers)
10 or [dhcp-users](https://lists.isc.org/mailman/listinfo/dhcp-users) mailing lists. The kea-users is
11 intended for users who are not interested in the internal workings or development details: it is
12 OK to ask for feedback regarding new design or the best proposed solution to a certain problem.
13 This is the best place to get user's feedback. The internal details, questions about the code and
14 its internals are better asked on dhcp-workers. The dhcp-workers is a very low traffic list.
15
16 OK, so you have written a patch? Great! Before you submit it, make sure that your code compiles.
17 This may seem obvious, but there's more to it. You have surely checked that it compiles on your
18 system, but ISC DHCP is a portable software. Besides Linux, it is compiled and used on relatively
19 uncommon systems like OpenBSD. Will your code compile and work there? What about endianness? It is
20 likely that you used a regular x86 architecture machine to write your patch, but the software is
21 expected to run on many other architectures. For a complete list of systems we build on, you may
22 take a look at the [Jenkins build farm report](https://jenkins.isc.org/view/Kea_BuildFarm/).
23
24 ## Running unit-tests
25
26 One of the ground rules in all ISC projects is that every piece of code has to be tested. For newer
27 projects, such as Kea, we require unit-test for almost every line of code. For older code, such as
28 ISC DHCP, that was not developed with testability in mind, it's unfortunately impractical to require
29 extensive unit-tests. Having said that, please think thoroughly if there is any way to develop
30 unit-tests. The long term goal is to improve the situation.
31
32 Building ISC DHCP code from the repository is slightly different than the release tarballs. One
33 major difference is that it does not have BIND source bundled inside and those have to be
34 downloaded separately. Fortunately, there's an easy to use script for that:
35
36 ```bash
37 sh util/bind.sh v4_4
38 ./configure --with-atf
39 make
40 ```
41
42 Make sure you have ATF (Automated Test Framework) installed in your system. To run the unit-tests,
43 simply run:
44
45 ```bash
46 make check
47 ```
48
49 If you happen to add new files or have modified any Makefile.am files, it is also a good idea to
50 check if you haven't broken the distribution process:
51
52 ```bash
53 make distcheck
54 ```
55
56 There are other useful switches which can be passed to configure. A complete list of all switches
57 can be obtained with the command:
58
59 ```bash
60 ./configure --help
61 ```
62
63 ## Create an issue
64
65 Since you want to change something in ISC DHCP, there's a problem, deficiency or a missing feature.
66 Quite often it is not clear why specific change is being made. The best way to explain it is to
67 [create an issue here](https://gitlab.isc.org/isc-projects/dhcp/issues/new). We prefer the original
68 submitter fill them as he or she has the best understanding of the purpose of the change and may
69 have any extra information, e.g. "this patch fixes compilation issue on FreeBSD 10.1". If there there
70 is no MR and no gitlab issue, we will create one. Depending on the subjective importance and urgency
71 as perceived by the ISC engineer, the issue and/or MR will be assigned to one of the milestones.
72
73 ## Merge Request (also known as sending your patch the right way)
74
75 The first step in writing the patch or new feature should be to get the source code from our Git
76 repository. The procedure is very easy and is [explained here](https://gitlab.isc.org/isc-projects/dhcp/wikis/gitlab-howto).
77 While it is possible to provide a patch against the latest stable release, it makes the review
78 process much easier if it is for latest code from the Git master branch.
79
80 Since you won't get write access to the ISC DHCP repository, you should fork it and then commit
81 your changes to your own repo. How you organize the work depends entirely on you, but it seems
82 reasonable to create a branch rather than working on your master. Once you feel that your patch
83 is ready, please commit your changes and push it to your copy of Kea repo. Then go to Kea project
84 and [submit a Merge Request](https://gitlab.isc.org/isc-projects/kea/merge_requests/new).
85
86 TODO: I don't think this is necessary. If you can't access this link or don't see New Merge Request
87 button on the [merge requests page](https://gitlab.isc.org/isc-projects/kea/merge_requests)
88 or the link gives you 404 error, please ask on dhcp-users and someone will help you out.
89
90 Once you submit it, someone from the DHCP development team will look at it and will get back to you.
91 The dev team is very small, so it may take a while...
92
93 ## If you really can't do MR on gitlab...
94
95 Well, you are out of luck. There are other ways, but those are really awkward and the chances of
96 your patch being ignored are really high. Anyway, here they are:
97
98 - Create a ticket in the DHCP Gitlab (https://gitlab.isc.org/isc-projects/dhcp) and attach your
99 patch to it. Sending a patch has a number of disadvantages. First, if you don't specify the base
100 version against which it was created, one of ISC engineers will have to guess that or go through
101 a series of trials and errors to find that out. If the code doesn't compile, the reviewer will not
102 know if the patch is broken or maybe it was applied to incorrect base code. Another frequent
103 problem is that it may be possible that the patch didn't include any new files you have added.
104
105 - Send a patch to the dhcp-workers list. This is even worse, but still better than not getting the
106 patch at all. The problem with this approach is that we don't know which version the patch was
107 created against and there is no way to track it. So the chances of it being forgotten are high.
108 Once a DHCP developer get to it, the first thing he/she will have to do is try to apply your
109 patch, create a branch commit your changes and then open MR for it.
110
111 ## Going through a review
112
113 Once the MR is in the system, the action is on one of the ISC (and possibly other trusted) engineers.
114
115 Sooner or later, one of ISC engineers will do the review. Here's the tricky part. One of Kea
116 developers will review your patch, but it may not happen immediately. Unfortunately, developers
117 are usually working under a tight schedule, so any extra unplanned review work may take a while
118 sometimes. Having said that, we value external contributions very much and will do whatever we
119 can to review patches in a timely manner. Don't get discouraged if your patch is not accepted
120 after first review. To keep the code quality high, we use the same review processes for external
121 patches as we do for internal code. It may take some cycles of review/updated patch submissions
122 before the code is finally accepted. The nature of the review process is that it emphasizes areas
123 that need improvement. If you are not used to the review process, you may get the impression that
124 the feedback is negative. It is not: even the Kea developers seldom see reviews that say "All OK
125 please merge".
126
127 If we happen to have any comments that you as submitter are expected to address (and in the
128 overwhelming majority of cases, we have), you will be asked to update your MR. It is not
129 uncommon to see several rounds of such reviews, so this can get very complicated very quickly.
130
131 Once the process is almost complete, the developer will likely ask you how you would like to be
132 credited. The typical answers are by first and last name, by nickname, by company name or
133 anonymously. Typically we will add a note to the ChangeLog and also set you as the author of the
134 commit applying the patch and update the contributors section in the AUTHORS file. If the
135 contributed feature is big or critical for whatever reason, it may also be mentioned in release
136 notes.
137
138 Sadly, we sometimes see patches that are submitted and then the submitter never responds to our
139 comments or requests for an updated patch. Depending on the nature of the patch, we may either fix
140 the outstanding issues on our own and get another ISC engineer to review them or the ticket may end
141 up in our Outstanding milestone. When a new release is started, we go through the tickets in
142 Outstanding, select a small number of them and move them to whatever the current milestone is. Keep
143 that in mind if you plan to submit a patch and forget about it. We may accept it eventually, but
144 it's much, much faster process if you participate in it.
145
146 ## Extra steps
147
148 If you are interested in knowing the results of more in-depth testing, you are welcome to visit the
149 ISC Jenkins page: https://jenkins.isc.org This is a live result page with all tests being run on
150 various systems. Besides basic unit-tests, we also have reports from valgrind (memory debugger),
151 cppcheck and clang-analyzer (static code analyzers), Lettuce system tests and more. Although it
152 is not possible for non ISC employees to run tests on that farm, it is possible that your
153 contributed patch will end up there sooner or later. We also have ISC Forge tests running and other
154 additional tests, but currently those test results are not publicly available.