@@ -33,10 +33,8 @@ 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+ $ make -C controller flake8
37+ flake8
4038
4139 No output, as above, means ``flake8 `` found no errors. If errors
4240are reported, fix them in your source code and try ``flake8 `` again.
@@ -60,18 +58,17 @@ ensure that everything passes and that code coverage has not declined.
6058
6159.. code-block :: console
6260
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
61+ $ make -C controller coverage
62+ coverage run manage.py test --noinput api cm provider web
63+ WARNING Cannot synchronize with etcd cluster
64+ Creating test database for alias 'default'...
65+ ................................................................... .
66+ ----------------------------------------------------------------------
67+ Ran 68 tests in 84.856s
7068
71- OK (skipped=2)
72- Destroying test database for alias 'default'...
73- coverage html
74- $
69+ OK
70+ Destroying test database for alias 'default'...
71+ coverage html
7572
7673 If a test fails, fixing it is obviously the first priority. And if you
7774have introduced new code, it must be accompanied by unit tests.
@@ -91,6 +88,7 @@ changes. Current test coverage can be found here:
9188
9289Pull Request
9390------------
91+
9492Now create a GitHub `pull request `_ with a description of what your code
9593fixes or improves.
9694
@@ -105,6 +103,7 @@ automatically close the `GitHub issue`_ when the pull request is merged.
105103
106104Merge Approval
107105--------------
106+
108107Deis maintainers add "**LGTM **" (Looks Good To Me) in code
109108review comments to indicate that a PR is acceptable. Any code change--other than
110109a simple typo fix or one-line documentation change--requires at least two of
@@ -119,3 +118,181 @@ Deis' maintainers to accept the change in this manner before it can be merged.
119118.. _`The Zen of Python` : http://www.python.org/dev/peps/pep-0020/
120119.. _`pull request` : https://github.com/opdemand/deis/pulls
121120.. _`GitHub issue` : https://github.com/opdemand/deis/issues
121+
122+
123+ .. _commit_style_guide :
124+
125+ Commit Style Guide
126+ ------------------
127+
128+ There are several reasons why we try to follow a specific style guide for commits:
129+
130+ - it allows us to recognize unimportant commits like formatting
131+ - it provides better information when browsing the git history
132+
133+ Recognizing Unimportant Commits
134+ ```````````````````````````````
135+
136+ These commits are usually just formatting changes like adding/removing spaces/empty lines,
137+ fixing indentation, or adding comments. So when you are looking for some change in the
138+ logic, you can ignore these commits - there's no logic change inside this commit.
139+
140+ When bisecting, you can ignore these by running:
141+
142+ .. code-block :: console
143+
144+ git bisect skip $(git rev-list --grep irrelevant <good place> HEAD)
145+
146+ Providing more Information when Browsing the History
147+ ````````````````````````````````````````````````````
148+
149+ This adds extra context to our commit logs. Look at these messages (taken from the last
150+ few AngularJS commits):
151+
152+ - Fix small typo in docs widget (tutorial instructions)
153+ - Fix test for scenario.Application - should remove old iframe
154+ - docs - various doc fixes
155+ - docs - stripping extra new lines
156+ - Replaced double line break with single when text is fetched from Google
157+ - Added support for properties in documentation
158+
159+ All of these messages try to specify where the change occurs, but they don’t share any
160+ convention. Now look at these messages:
161+
162+ - fix comment stripping
163+ - fixing broken links
164+ - Bit of refactoring
165+ - Check whether links do exist and throw exception
166+ - Fix sitemap include (to work on case sensitive linux)
167+
168+ Are you able to guess what’s inside each commit diff?
169+
170+ It's true that you can find this information by checking which files had been changed, but
171+ that’s slow. When looking in the git history, we can see that all of the developers are
172+ trying to specify where the change takes place, but the message is missing a convention.
173+ Cue commit message formatting entrance stage left.
174+
175+ Format of the Commit Message
176+ ````````````````````````````
177+
178+ .. code-block :: console
179+
180+ {type}({scope}): {subject}
181+ <BLANK LINE>
182+ {body}
183+ <BLANK LINE>
184+ {footer}
185+
186+ Any line of the commit message cannot be longer than 90 characters, with the subject
187+ line limited to 70 characters. This allows the message to be easier to read on github
188+ as well as in various git tools.
189+
190+ Subject Line
191+ """"""""""""
192+
193+ The subject line contains a succinct description of the change to the logic.
194+
195+ The allowed {types} are as follows:
196+
197+ - feat -> feature
198+ - fix -> bug fix
199+ - docs -> documentation
200+ - style -> formatting
201+ - refactor
202+ - test -> adding missing tests
203+ - chore -> maintenance
204+
205+ The {scope} can be anything specifying place of the commit change e.g. the controller,
206+ the client, the logger, etc.
207+
208+ The {subject} needs to use imperative, present tense: “change”, not “changed” nor
209+ “changes”. The first letter should not be capitalized, and there is no dot (.) at the end.
210+
211+ Message Body
212+ """"""""""""
213+
214+ Just like the {subject}, the message {body} needs to be in the present tense, and includes
215+ the motivation for the change, as well as a contrast with the previous behavior.
216+
217+ Message Footer
218+ """"""""""""""
219+
220+ All breaking changes need to be mentioned in the footer with the description of the
221+ change, the justification behind the change and any migration notes required. For example:
222+
223+ .. code-block :: console
224+
225+ BREAKING CHANGE: the controller no longer listens on port 80. It now listens on
226+ port 8000, with the router redirecting requests on port 80 to the controller. To
227+ migrate to this change, SSH into your controller and run:
228+
229+ $ docker kill deis-controller
230+ $ docker rm deis-controller
231+
232+ and then restart the controller on port 8000:
233+
234+ $ docker run -d -p 8000:8000 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> \
235+ -e PORT=8000 -name deis-controller deis/controller
236+
237+ now you can start the proxy component by running:
238+
239+ $ docker run -d -p 80:80 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> -e PORT=80 \
240+ -name deis-router deis/router
241+
242+ The router should then start proxying requests from port 80 to the controller.
243+
244+ Referencing Issues
245+ """"""""""""""""""
246+
247+ Closed bugs should be listed on a separate line in the footer prefixed with the "closes"
248+ keyword like this:
249+
250+ .. code-block::console
251+
252+ closes #123
253+
254+ Or in the case of multiple issues:
255+
256+ .. code-block::console
257+
258+ closes #123, #456, #789
259+
260+ Examples
261+ ````````
262+
263+ .. code-block :: console
264+
265+ feat(controller): add router component
266+
267+ This introduces a new router component to Deis, which proxies requests to Deis
268+ components.
269+
270+ closes #123
271+
272+ BREAKING CHANGE: the controller no longer listens on port 80. It now listens on
273+ port 8000, with the router redirecting requests on port 80 to the controller. To
274+ migrate to this change, SSH into your controller and run:
275+
276+ $ docker kill deis-controller
277+ $ docker rm deis-controller
278+
279+ and then restart the controller on port 8000:
280+
281+ $ docker run -d -p 8000:8000 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> \
282+ -e PORT=8000 -name deis-controller deis/controller
283+
284+ now you can start the proxy component by running:
285+
286+ $ docker run -d -p 80:80 -e ETCD=<etcd_endpoint> -e HOST=<host_ip> -e PORT=80 \
287+ -name deis-router deis/router
288+
289+ The router should then start proxying requests from port 80 to the controller.
290+ ----------------------------------------------------------------------------------
291+ test(client): add unit tests for app domains
292+
293+ Nginx does not allow domain names larger than 128 characters, so we need to make
294+ sure that we do not allow the client to add domains larger than 128 characters.
295+ A DomainException is raised when the domain name is larger than the maximum
296+ character size.
297+
298+ closes #392
0 commit comments