...
- All public classes and methods should have informative Javadoc comments.
- Do not use @author tags.
- Code should be formatted according to Sun's conventions, with these exceptions:
- Indent four spaces per level, not two or six or eight, etc... four.
- No tabs for indentation, spaces only
- Contributions should pass existing unit tests.
- New unit tests should be provided to demonstrate bugs and fixes. JUnit is our test framework:
- You must implement a class that extends
junit.framework.TestCase
and whose class name ends withTest
. - Define methods within your class whose names begin with
test
, and call JUnit's many assert methods to verify conditions; these methods will be executed when you runant test
. - By default, do not let tests write any temporary files to
/tmp
. Instead, the tests should write to the location specified by thetest.build.data
system property. - Place your class in the
src/java/test
tree. ClientTest.java
is an example of a client-server test.- You can run all the unit test with the command
ant test
, or you can run a specific unit test with the commandant -Dtestcase=<class name without package prefix> test
(for exampleant -Dtestcase=ClientTest test
)
- You must implement a class that extends
Understanding Ant
ZooKeeper is built by Ant, a Java building tool. This section will eventually describe how Ant is used within ZooKeeper. To start, simply read a good Ant tutorial. The following is a good tutorial, though keep in mind that ZooKeeper isn't structured according to the ways outlined in the tutorial. Use the tutorial to get a basic understand of Ant but not to understand how Ant is used for Hadoop:
Good Ant tutorial: http://i-proving.com/2005/10/31/ant-tutorial
Contribute Work via Github Pull Request
We accept pull requests via github against the apache/zookeeper repository. Submitting to Apache ZooKeeper via github is no different than submitting any other pull request against a github repository. The developer needs to follow the contribution guidelines to produce changes, just like with patch files, and once it is ready, the developer produces a pull request from his/her own branch. The one constraints we have is that the title of the pull request must match the paring JIRA issue. If the JIRA issue is "ZOOKEEPER-222222: My lovely bug", then the pull request issue must also match "ZOOKEEPER-222222: My lovely bug".
We currently perform QA on pull requests, although the process is still being polished. We also have not completed the JIRA workflow when the developer submits a pull request, which means that the JIRA does not transition to Patch Available when a pull request is submitted. We are currently discussing on the list how to adapt our workflow.
Example workflow
there are many ways to setup your git environment but this one example:
fork the apache github repo
go to https://github.com/apache/zookeeper and click the fork button to create your own fork.
make a local clone of your fork
on your local machine run
...
language | bash |
---|
...
Contribute Work via Github Pull Request
We accept pull requests via github against the apache/zookeeper repository. Submitting to Apache ZooKeeper via github is no different than submitting any other pull request against a github repository. The developer needs to follow the contribution guidelines to produce changes, just like with patch files, and once it is ready, the developer produces a pull request from his/her own branch. The one constraints we have is that the title of the pull request must match the paring JIRA issue. If the JIRA issue is "ZOOKEEPER-222222: My lovely bug", then the pull request issue must also match "ZOOKEEPER-222222: My lovely bug".
We currently perform QA on pull requests, although the process is still being polished. We also have not completed the JIRA workflow when the developer submits a pull request, which means that the JIRA does not transition to Patch Available when a pull request is submitted. We are currently discussing on the list how to adapt our workflow.
Example workflow
there are many ways to setup your git environment but this one example:
fork the apache github repo
go to https://github.com/apache/zookeeper and click the fork button to create your own fork.
make a local clone of your fork
on your local machine run
Code Block | ||
---|---|---|
| ||
$ git clone https://github.com/<userid>/zookeeper.git my-zookeeper |
...
To use this target, you must run it from a clean workspace (ie git status
shows no modifications or additions). From your clean workspace, run:
Code Block |
---|
ant test mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4 |
At the end, you should get a message on your console that indicates success.
Some things to note:
- you may need to explicitly set ANT_HOME. Running
ant -diagnostics
will tell you the default value on your system. - you may need to explicitly set JAVA_HOME.
Please make sure that all unit tests succeed before submitting pull request and that no new javac compiler warnings are introduced by your pull request
Code Block |
---|
> cd zookeeper-trunk
> ant -Djavac.args="-Xlint -Xmaxwarns 1000" clean test tar
|
After a while, if you see
Code Block |
---|
BUILD SUCCESSFUL
|
all is ok, but if you see
Code Block |
---|
BUILD FAILED
|
then please examine error messages in build/test
and fix things before proceeding.
Javadoc
Please also check the javadoc.
Code Block |
---|
> ant javadoc
> firefox build/docs/api/index.html
|
Examine all public classes you've changed to see that documentation is complete, informative, and properly formatted. Your patch must not generate any javadoc warnings.
Documentation
The source documentation is available in Please make sure that all unit tests succeed before submitting pull request and that no new javac compiler warnings are introduced by your pull request
After a while, if you see
Code Block |
---|
BUILD SUCCESSFUL
|
all is ok, but if you see
Code Block |
---|
BUILD FAILED
|
then please examine error messages in build/test
and fix things before proceeding.
Javadoc
Please also check the javadoc.
Code Block |
---|
> mvn install -DskipTests -pl zookeeper-docs
> firefox build/docs/api/index.html
|
Examine all public classes you've changed to see that documentation is complete, informative, and properly formatted. Your patch must not generate any javadoc warnings.
Documentation
The source documentation is available in src/docs directory. It can be regenerated using forrest (as documented here) however the contributor is not responsible for submitting this as part of the pull request. To be clear: the pull request should include changes to src/docs but not the toplevel (of the source tree) docs directory.
...
Please note that the attachment should be granted license to ASF for inclusion in ASF works (as per the Apache License §5).
Folks should run ant clean test javadoc
before a full check (mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4) before submitting pull request. Tests should all pass. Javadoc should report no warnings or errors. Jenkin's tests are meant to double-check things, and not be used as a primary patch tester, which would create too much noise on the mailing list and in Jira. Submitting patches that fail Jenkins testing is frowned on, (unless the failure is not actually due to the patch).
...
- Close and reopen the pull request. This is the recommended approach, and only the contributor who owns the pull request can do this.
- Update the PR by pushing a new commit or amend the previous commit (git commit --amend). This is also recommended approach and only contributor who owns the pull request can do this.
- Any committer or PMC member (actually anyone who is part of 'apache' github organization) can trigger the job just by adding a comment with the magic phrases:
- 'retest ant build' in order to re run ANT based build
- 'retest maven build' in order to re run MAVEN based build
- Note for administrators: configuration of these phrases are in the precommit Jenkins jobs, it is using the GitHub Pull Request builder plugin)
For contributors who owns the pull request: please make sure to get a green build to prepare the patch in a landing state.
...
- (update on Sep, 2020 - currently this trigger phrase is broken. Workaround is for committers to manually trigger the job in CI admin UI, or for contributors to do a commit with a new SHA - e.g. commit --amend then push to remote to trigger the job).
- Note for administrators: configuration of these phrases are in the precommit Jenkins jobs, it is using the GitHub Pull Request builder plugin)
For contributors who owns the pull request: please make sure to get a green build before committing a pull request.
Code Review and Accept Pull Request
Once a "+1" comment is received from the automated patch testing system and a code reviewer has set the Reviewed flag on the issue's Jira, a committer should then evaluate it within a few days and either: commit it; or reject it with an explanation.
Please be patient. Committers are busy people too. If no one responds to your patch after a few days, please make friendly reminders. Please incorporate other's suggestions into your patch if you think they're reasonable. Finally, remember that even a patch that is not committed is useful to the community.
Should your patch receive a "-1" from the Jenkins testing, select the Resume Progress on the issue's Jira, update pull request with necessary fixes.
Committers: for non-trivial changes, it is best to get another committer to review your pull request before commit. Please also try to frequently review things in the patch queue.
Committing Guidelines for committers
Apply the patch uploaded by the user. Edit the CHANGES.txt file, adding a description of the change, including the bug number it fixes. Add it to the appropriate section - BUGFIXES, IMPROVEMENTS, NEW FEATURES. Please follow the format in CHANGES.txt file. While adding an entry please add it to the end of a section. Use the same entry for the git commit message.to prepare the patch in a landing state.
For committers: please make sure to get a green build before committing a pull request.
Code Review and Accept Pull Request
Once a "+1" comment is received from the automated patch testing system and a code reviewer has set the Reviewed flag on the issue's Jira, a committer should then evaluate it within a few days and either: commit it; or reject it with an explanation.
Please be patient. Committers are busy people too. If no one responds to your patch after a few days, please make friendly reminders. Please incorporate other's suggestions into your patch if you think they're reasonable. Finally, remember that even a patch that is not committed is useful to the community.
Should your patch receive a "-1" from the Jenkins testing, select the Resume Progress on the issue's Jira, update pull request with necessary fixes.
Committers: for non-trivial changes, it is best to get another committer to review your pull request before commit. Please also try to frequently review things in the patch queue.
Committing Guidelines for committers
Jira Guidelines
Please comment on issues in Jira, making their concerns known. Please also vote for issues that are a high priority for you.
...