Skip to content

Commit 85d5c92

Browse files
authored
CONTRIBUTING: add some initial guidelines (#6485)
Some rough guidelines on the contribution process for the project. Intended more as a starting point for a discussion.
2 parents 755d33b + d5a6e88 commit 85d5c92

File tree

2 files changed

+165
-0
lines changed

2 files changed

+165
-0
lines changed

CONTRIBUTING.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Issues
2+
3+
We welcome reports of technical issues with the components of the xen-api
4+
toolstack. Please make sure that the description of the issue is as detailed as
5+
possible to help anyone investigating it:
6+
7+
1) Mention how it was detected, if and how it could be reproduced
8+
9+
1) What's the desired behaviour? In what cases would it be useful?
10+
11+
1) Include error messages, related logs if appropriate
12+
13+
# Pull Requests
14+
15+
To contribute changes to xen-api, please fork the repository on
16+
GitHub, and then submit a pull request.
17+
18+
It is required to add a `Signed-off-by:` as a
19+
[Developers Certificate of Origin](http://developercertificate.org).
20+
It certifies the patch's origin and is licensed under an
21+
appropriate open-source licence to include it in Xapi:
22+
https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff
23+
24+
The following points are intended to describe what makes a contribution "good" -
25+
easier to review, integrate, and maintain. Please follow them in your work.
26+
27+
## Commit subjects and PR titles
28+
29+
Commit subjects should preferrably start with the name of the component the
30+
commit is most related to, and describe what the commit achieves. If your
31+
commit only touches the `ocaml/xenopsd` directory, it should look like this,
32+
for example:
33+
34+
```
35+
xenopsd: Fix a deadlock during VM suspend
36+
```
37+
38+
Similar principle applies to Pull Request titles. If there is only a single
39+
commit in the PR, Github will automatically copy its subject and description to
40+
the PR's title and body. If there are several commits in the PR, describe what
41+
the PR achieves and the components it most directly impacts.
42+
43+
If the commit subject includes some tracking identifier (such as `CP-1234`, for
44+
example) referring to internal systems, please make sure to include all of the
45+
essential information in the public descriptions - describe the symptoms of the
46+
issue, how it was detected, investigated, how it could be reproduced, what are
47+
the trade-offs and so on as appropriate.
48+
49+
## Split into commits
50+
51+
Following from the rules described above, if what the commit achieves is
52+
difficult to fit into its subject, it is probably better to split it into
53+
several commits, if possible. Note that every commit should build (`make`
54+
should work and the CI should pass) independently, without requiring future
55+
commits. This means some modifications can't really be split into several
56+
commits (datamodel changes, in particular, require modifications to several
57+
components at the same time), but makes it easier to revert part of the Pull
58+
Request if some issues are detected in integration testing at a later point.
59+
60+
## Good Commit Messages
61+
62+
Commit messages (and the body of a Pull Request) should be as helpful and
63+
descriptive as possible. If applicable, please include a description of current
64+
behaviour, your changes, and the new behaviour. Justify the reasoning behind
65+
your changes - are they sufficient on their own, or preparing for more changes?
66+
Link any appropriate documentation, issues, or commits (avoiding internal and
67+
publicly inaccessible sources)
68+
69+
## CI
70+
71+
Please make sure your Pull Request passes the Github CI. It will verify that
72+
your code has been properly formatted (can be done locally with `make format`),
73+
builds (`make` and `make check`), and passes the unit tests (`make test`).
74+
The CI will run in the branches of your fork, so you can verify it passes
75+
there before opening a Pull Request.
76+
77+
## Testing
78+
79+
Describe what kind of testing your contribution underwent. If the testing was
80+
manual, please describe the commands or external clients that were used. If the
81+
tests were automated, include at least a cursory description/name of the tests,
82+
when they were regressed, if possible.
83+
84+
Please note that any contribution to the code of the project will likely
85+
require at least some testing to be done. Depending on how central the
86+
component touched in your PR is to the system, the more things could only be
87+
detected in real-world usecases through integration testing.
88+
89+
If a commit has been determined to break integration testing at a later stage,
90+
please note that the first and safest measure will almost always be reverting
91+
the faulty commit. Making sure critical tests are passing remains a priority
92+
over waiting for some commit to be reworked or refactored (which can be worked
93+
on after a revert has been done). Though we are striving to make more tests
94+
public (with failure then being visible to all), as long as some critical tests
95+
remain private, this will also apply to such tests (with maintainers flagging
96+
the breakage preferrably describing at least the gist of the test).
97+
98+
If you are still waiting on some testing to be done, please mark the PR as a
99+
"draft" and make the reasoning clear.
100+
101+
If wider testing is needed (e.g. the change itself is believed to be correct
102+
but may expose latent bugs in other components), lightweight feature flags can
103+
also be used. E.g. an entry in `xapi_globs.ml` and `xapi.conf`, where the
104+
feature/change is defaulted to `off`, to be turned on at a future time
105+
(when e.g. more related PRs land, or it has passed some wider testing).
106+
107+
If your contribution doesn't intend to have any functional changes, please make
108+
that clear as well.
109+
110+
## Feature work
111+
112+
If your contribution adds some new feature or reworks some major aspect of the
113+
system (as opposed to one-off fixes), it can be benefitial to first describe
114+
the plan of your work in a design proposal. Architectural issues are better
115+
spotted early on, and taking a big-picture view can often lead to new insights.
116+
117+
An example of a design proposal is here:
118+
119+
https://github.com/xapi-project/xen-api/pull/6387
120+
121+
If submitting a design first is not possible, include documentation alongside
122+
with your PR describing the work, like it was done in the last three commits
123+
here:
124+
125+
https://github.com/xapi-project/xen-api/pull/6457
126+
127+
Note that the design will often serve as documentation as well - so take care
128+
updating it after the implementation is done to better reflect reality.
129+
130+
## Review process and merge
131+
132+
It can often be useful to address review suggestions with a "fixup" commit
133+
(created manually or with the help of `git commit --fixup=HASH`). This way it
134+
is clear what the original code was and what your fix touches. Once the
135+
fixup commit has been reviewed and the PR approved, please squash the fixup
136+
commits with `git rebase --autosquash` before merging. Otherwise the commits in
137+
the Pull Request should stay as independent commits - we do not require
138+
squashing all the commits into a single one on merge.
139+
140+
If the commit fixes a bug in an earlier, already merged PR then it might be
141+
useful to mention that in the commit, if known.
142+
143+
This can be done by adding this to your GIT configuration:
144+
145+
```
146+
[pretty]
147+
fixes = Fixes: %h (\"%s\")
148+
```
149+
150+
And then running:
151+
152+
```
153+
# git log -1 --pretty=fixes <hash-of-bad-commit>
154+
Fixes: 1c581c074 ("xenopsd: Fix a deadlock during VM suspend")
155+
```
156+
157+
This will print the commit title and hash in a nice format, which can then be
158+
added to the footer of the commit message (alongside the sign-off).
159+
160+
This is useful information to have if any of these commits get backported to
161+
another release in the future, so that we also backport the bugfixes, not just
162+
the buggy commits.

README.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ It certifies the patch's origin and is licensed under an
108108
appropriate open-source licence to include it in Xapi:
109109
https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff
110110
111+
For more detailed guidelines on what makes a good contribution, see
112+
[CONTRIBUTING](./CONTRIBUTING.md).
113+
111114
Discussions
112115
-----------
113116

0 commit comments

Comments
 (0)