Skip to content

Commit d66bc17

Browse files
author
Matthew Fisher
committed
docs(standards): add commit style guide
this introduces a new commit standard for Deis developers. The goal of this commit is to allow developers to search through the history better, provide us better information through commit messages, and eventually allowing us to script the CHANGELOG.md so that we do not have to rely on a third-party tool to do the parsing for us.
1 parent ae097a0 commit d66bc17

2 files changed

Lines changed: 299 additions & 15 deletions

File tree

CONTRIBUTING.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# How to Contribute
2+
3+
The Deis project is Apache 2.0 licensed and accepts contributions via Github pull
4+
requests. This document outlines some of the conventions on commit message formatting,
5+
contact points for developers and other resources to make getting your contribution
6+
accepted.
7+
8+
# Certificate of Origin
9+
10+
By contributing to this project you agree to the Developer Certificate of Origin (DCO).
11+
This document was created by the Linux Kernel community and is a simple statement that
12+
you, as a contributor, have the legal right to make the contribution.
13+
14+
```
15+
Developer Certificate of Origin
16+
Version 1.1
17+
18+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
19+
660 York Street, Suite 102,
20+
San Francisco, CA 94110 USA
21+
22+
Everyone is permitted to copy and distribute verbatim copies of this
23+
license document, but changing it is not allowed.
24+
25+
26+
Developer's Certificate of Origin 1.1
27+
28+
By making a contribution to this project, I certify that:
29+
30+
(a) The contribution was created in whole or in part by me and I
31+
have the right to submit it under the open source license
32+
indicated in the file; or
33+
34+
(b) The contribution is based upon previous work that, to the best
35+
of my knowledge, is covered under an appropriate open source
36+
license and I have the right under that license to submit that
37+
work with modifications, whether created in whole or in part
38+
by me, under the same open source license (unless I am
39+
permitted to submit under a different license), as indicated
40+
in the file; or
41+
42+
(c) The contribution was provided directly to me by some other
43+
person who certified (a), (b) or (c) and I have not modified
44+
it.
45+
46+
(d) I understand and agree that this project and the contribution
47+
are public and that a record of the contribution (including all
48+
personal information I submit with it, including my sign-off) is
49+
maintained indefinitely and may be redistributed consistent with
50+
this project or the open source license(s) involved.
51+
```
52+
53+
54+
# Support Channels
55+
56+
- IRC: #[deis](irc://irc.freenode.org:6667/#deis) IRC channel on freenode.org
57+
58+
## Getting Started
59+
60+
- Fork the repository on GitHub
61+
- Read the README.md for build instructions
62+
63+
## Contribution Flow
64+
65+
This is a rough outline of what a contributor's workflow looks like:
66+
67+
- Create a topic branch from where you want to base your work. This is usually master.
68+
- Make commits of logical units.
69+
- Make sure your commit messages are in the proper format, see below
70+
- Push your changes to a topic branch in your fork of the repository.
71+
- Submit a pull request
72+
73+
Thanks for your contributions!
74+
75+
### Format of the Commit Message
76+
77+
We follow a rough convention for commit messages borrowed from CoreOS, who borrowed theirs
78+
from AngularJS. This is an example of a commit:
79+
80+
```
81+
feat(scripts/test-cluster): add a cluster test command
82+
83+
this uses tmux to setup a test cluster that you can easily kill and
84+
start for debugging.
85+
```
86+
87+
To make it more formal it looks something like this:
88+
89+
```
90+
{type}({scope}): {subject}
91+
<BLANK LINE>
92+
{body}
93+
<BLANK LINE>
94+
{footer}
95+
```
96+
97+
Any line of the commit message cannot be longer than 90 characters, with the subject line
98+
limited to 70 characters. This allows the message to be easier to read on github as well
99+
as in various git tools.
100+
101+
### More Details on Commits
102+
103+
For more details see the [commit style guide][1].
104+
105+
[1]: http://docs.deis.io/en/latest/contributing/standards/#commit-style-guide

docs/contributing/standards.rst

Lines changed: 194 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ into the official repository, your code must pass two tests:
3333

3434
.. code-block:: console
3535
36-
$ cd $HOME/projects/deis
37-
$ make flake8
38-
flake8
39-
$
36+
$ cd $HOME/projects/deis
37+
$ make flake8
38+
flake8
39+
$
4040
4141
No output, as above, means ``flake8`` found no errors. If errors
4242
are reported, fix them in your source code and try ``flake8`` again.
@@ -60,18 +60,18 @@ ensure that everything passes and that code coverage has not declined.
6060

6161
.. code-block:: console
6262
63-
$ cd $HOME/projects/deis
64-
$ make coverage
65-
coverage run manage.py test api celerytasks client web
66-
Creating test database for alias 'default'...
67-
...................ss.
68-
----------------------------------------------------------------------
69-
Ran 22 tests in 22.630s
63+
$ cd $HOME/projects/deis
64+
$ make coverage
65+
coverage run manage.py test api celerytasks client web
66+
Creating test database for alias 'default'...
67+
...................ss.
68+
----------------------------------------------------------------------
69+
Ran 22 tests in 22.630s
7070
71-
OK (skipped=2)
72-
Destroying test database for alias 'default'...
73-
coverage html
74-
$
71+
OK (skipped=2)
72+
Destroying test database for alias 'default'...
73+
coverage html
74+
$
7575
7676
If a test fails, fixing it is obviously the first priority. And if you
7777
have introduced new code, it must be accompanied by unit tests.
@@ -91,6 +91,7 @@ changes. Current test coverage can be found here:
9191

9292
Pull Request
9393
------------
94+
9495
Now create a GitHub `pull request`_ with a description of what your code
9596
fixes or improves.
9697

@@ -105,6 +106,7 @@ automatically close the `GitHub issue`_ when the pull request is merged.
105106

106107
Merge Approval
107108
--------------
109+
108110
Deis maintainers add "**LGTM**" (Looks Good To Me) in code
109111
review comments to indicate that a PR is acceptable. Any code change--other than
110112
a simple typo fix or one-line documentation change--requires at least two of
@@ -119,3 +121,180 @@ Deis' maintainers to accept the change in this manner before it can be merged.
119121
.. _`The Zen of Python`: http://www.python.org/dev/peps/pep-0020/
120122
.. _`pull request`: https://github.com/opdemand/deis/pulls
121123
.. _`GitHub issue`: https://github.com/opdemand/deis/issues
124+
125+
126+
.. _commit_style_guide:
127+
128+
Commit Style Guide
129+
------------------
130+
131+
There are several reasons why we try to follow a specific style guide for commits:
132+
133+
- it allows us to recognize unimportant commits like formatting
134+
- it provides better information when browsing the git history
135+
136+
Recognizing Unimportant Commits
137+
```````````````````````````````
138+
139+
These commits are usually just formatting changes like adding/removing spaces/empty lines,
140+
fixing indentation, or adding comments. So when you are looking for some change in the
141+
logic, you can ignore these commits - there's no logic change inside this commit.
142+
143+
When bisecting, you can ignore these by running:
144+
145+
.. code-block:: console
146+
147+
git bisect skip $(git rev-list --grep irrelevant <good place> HEAD)
148+
149+
Providing more Information when Browsing the History
150+
````````````````````````````````````````````````````
151+
152+
This would add kinda “context” information. Look at these messages (taken from last few
153+
angular’s commits):
154+
155+
- Fix small typo in docs widget (tutorial instructions)
156+
- Fix test for scenario.Application - should remove old iframe
157+
- docs - various doc fixes
158+
- docs - stripping extra new lines
159+
- Replaced double line break with single when text is fetched from Google
160+
- Added support for properties in documentation
161+
162+
All of these messages try to specify where is the change. But they don’t share any
163+
convention. Look at these messages:
164+
165+
- fix comment stripping
166+
- fixing broken links
167+
- Bit of refactoring
168+
- Check whether links do exist and throw exception
169+
- Fix sitemap include (to work on case sensitive linux)
170+
171+
Are you able to guess what’s inside?
172+
173+
It's true that you can find this information by checking which files had been changed, but
174+
that’s slow. And when looking in git history I can see all of us tries to specify the
175+
place, only missing the convention. Cue commit message formatting entrance stage left.
176+
177+
Format of the Commit Message
178+
````````````````````````````
179+
180+
.. code-block:: console
181+
182+
{type}({scope}): {subject}
183+
<BLANK LINE>
184+
{body}
185+
<BLANK LINE>
186+
{footer}
187+
188+
Any line of the commit message cannot be longer than 90 characters, with the subject
189+
line limited to 70 characters. This allows the message to be easier to read on github
190+
as well as in various git tools.
191+
192+
Subject Line
193+
""""""""""""
194+
195+
The subject line contains a succinct description of the change to the logic.
196+
197+
The allowed {types} are as follows:
198+
199+
- feat -> feature
200+
- fix -> bug fix
201+
- docs -> documentation
202+
- style -> formatting
203+
- refactor
204+
- test -> adding missing tests
205+
- chore -> maintenance
206+
207+
The {scope} can be anything specifying place of the commit change e.g. the controller,
208+
the client, the logger, etc.
209+
210+
The {subject} needs to use imperative, present tense: “change”, not “changed” nor
211+
“changes”. The first letter should not be capitalized, and there is no dot (.) at the end.
212+
213+
Message Body
214+
""""""""""""
215+
216+
Just like the {subject}, the message {body} needs to be in the present tense, and includes
217+
the motivation for the change, as well as a contrast with the previous behavior.
218+
219+
Message Footer
220+
""""""""""""""
221+
222+
All breaking changes need to be mentioned in the footer with the description of the
223+
change, the justification behind the change and any migration notes required. For example:
224+
225+
.. code-block:: console
226+
227+
BREAKING CHANGE: the controller no longer listens on port 80. It now listens on
228+
port 8000, with the router redirecting requests on port 80 to the controller. To
229+
migrate to this change, SSH into your controller and run:
230+
231+
$ docker kill deis-controller
232+
$ docker rm deis-controller
233+
234+
and then restart the controller on port 8000:
235+
236+
$ docker run -d -p 8000:8000 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> \
237+
-e PORT=8000 -name deis-controller deis/controller
238+
239+
now you can start the proxy component by running:
240+
241+
$ docker run -d -p 80:80 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> -e PORT=80 \
242+
-name deis-router deis/router
243+
244+
The router should then start proxying requests from port 80 to the controller.
245+
246+
Referencing Issues
247+
""""""""""""""""""
248+
249+
Closed bugs should be listed on a separate line in the footer prefixed with the "closes"
250+
keyword like this:
251+
252+
.. code-block::console
253+
254+
closes #123
255+
256+
Or in the case of multiple issues:
257+
258+
.. code-block::console
259+
260+
closes #123, #456, #789
261+
262+
Examples
263+
````````
264+
265+
.. code-block:: console
266+
267+
feat(controller): add router component
268+
269+
This introduces a new router component to Deis, which proxies requests to Deis
270+
components.
271+
272+
closes #123
273+
274+
BREAKING CHANGE: the controller no longer listens on port 80. It now listens on
275+
port 8000, with the router redirecting requests on port 80 to the controller. To
276+
migrate to this change, SSH into your controller and run:
277+
278+
$ docker kill deis-controller
279+
$ docker rm deis-controller
280+
281+
and then restart the controller on port 8000:
282+
283+
$ docker run -d -p 8000:8000 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> \
284+
-e PORT=8000 -name deis-controller deis/controller
285+
286+
now you can start the proxy component by running:
287+
288+
$ docker run -d -p 80:80 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> -e PORT=80 \
289+
-name deis-router deis/router
290+
291+
The router should then start proxying requests from port 80 to the controller.
292+
----------------------------------------------------------------------------------
293+
test(client): add unit tests for app domains
294+
295+
Nginx does not allow domain names larger than 128 characters, so we need to make
296+
sure that we do not allow the client to add domains larger than 128 characters.
297+
A DomainException is raised when the domain name is larger than the maximum
298+
character size.
299+
300+
closes #392

0 commit comments

Comments
 (0)