Welcome contributors! This page provides necessary guidelines on how to contribute towards furthering the development and evolution of Apache Lens.
Contributions are welcome in all the following forms which improves the project overall.
Below sections guide a developer on how to contribute code or doc changes to Lens.
Lens uses git for its code repository. The repository is available at https://git-wip-us.apache.org/repos/asf/incubator-lens.git.
If you are comfortable working in github environment by forking a github repo, sothat you can push changes to your repository before they are accepted in apache, we have a mirror of source at https://github.com/apache/incubator-lens. Its better to add the apache repo as remote than github repo, because github repo might be delayed as it is a mirror of apache repo.
Ensure all the tools are installed by executing mvn, git and javac respectively.
As the Lens builds use the external Maven repository to download artifacts, Maven needs to be set up with the proxy settings needed to make external HTTP requests. The first build of every Lens project needs internet connectivity to download Maven dependencies.
Download Apache Lens source release from here.
unzip apache-lens-<version>-source.release.zip cd apache-lens-<version> mvn clean package -DskipTests
OR Clone Apache Lens source code from https://git-wip-us.apache.org/repos/asf/incubator-lens.git
git clone https://git-wip-us.apache.org/repos/asf/incubator-lens.git cd incubator-lens mvn clean package -DskipTests
Once one of the above sets of commands completes successfully, the build will produce lens-dist/target/apache-lens-<version-bin/apache-lens-version-bin/server> and lens-dist/target/apache-lens-<version-bin/apache-lens-version-bin/client>. Former can be used as the Lens server installation directory and later can be used as Lens client installation directory to run lens server and lens client.
The build will also produce debians for both client and server in lens-dist/target. Client debian uses /usr/local/lens/client as the Lens client installation directory and Server debian uses /usr/local/lens/server as the Lens server installation directory.
Apache Lens depends on Hive. Please build Hive from Source or install it using the documentation here. After installing Lens and Hive, refer here for running lens client and lens server from installation directories.
git clone https://github.com/InMobi/hive.git cd hive git checkout <release-tag> mvn clean package -DskipTests -Phadoop-2,dist
Once above package command completes successfully, packaging/target will have apache-hive-$project.version-bin. This build also produces source, binary tar.gz files and deb package for hive.
Set the environment variable HIVE_HOME to point to the Hive installation directory built from source:
cd packaging/target/apache-hive-$project.version-bin/apache-hive-$project.version-bin export HIVE_HOME=`pwd`
All code changes should be initiated based on an issue in LENS JIRA, so that other contributors are aware of the proposed work and have the opportunity to actively participate (through review, suggestions, etc). This also allows scoping the changes in appropriate releases. Code contributions are to be made available as a patch against a specific JIRA created for the task. Once patches are attached to the JIRA, the JIRA issue should be marked as "Patch available" by clicking submit. Lens project follows RTC (Review then commit). If the change is bigger than a couple of lines of code, contributor should raise a review request on review board and attach the patch on jira once review request gets "Ship it" from one of the reviewers. It is recommended that large changes are broken up into smaller changes, thus making it easy for review. The patches should comply with the requirements below before they are made available for review.
All contributions should satisfy the following requirements
Developers should follow the following naming convention for configuration properties
Check to see what files you have modified with:
git status
Add any new files with:
git add src/.../MyNewClass.java git add src/.../TestMyNewClass.java
In order to create a patch, type the following:
git diff --no-prefix > LENS-1234.patch
This will report all modifications done on Lens sources on your local disk and save them into the LENS-1234.patch file. Read the patch file. Make sure it includes ONLY the modifications required to fix a single issue.
Please do not:
Please do:
Patches for master should be named according to the Jira: jira-xyz.patch, eg LENS-1234.patch.
Patches for a branch should be named jira-xyz-branch.patch, eg LENS-1234-branch-x.patch. The branch name suffix should be the exact name of a git branch.
It's OK to upload a new patch to Jira with the same name as an existing patch. However many contributors find it convenient to add a numeric suffix to the patch indicating the patch revision. e.g. LENS-1234.01.patch, LENS-1234.02.patch etc.
Before submitting your patch, make sure all tests pass by running mvn clean package . Upon successful completion of the build, you can upload the patch on the JIRA and mark the JIRA as patch available. Till the automatic jenkins setup is available to verifying patch available issues, please update the test report on jira. Once a committer reviews the change, it will be committed to the repo and jira issue will be resolved.
Install reviewboard command line tool:
Whenever you want to publish a new review request, commit all the changes you want to send to the request and do:
rbt post --parent=master
Reviewboard is not foolproof. Sometimes this will create a review request but wouldn't attach the patch. In that case, you have to manually create the patch and upload it to the url of the request. To create the patch:
git diff master..HEAD > ~/LENS-##.patch
For updating an existing review request:
rbt post -u --parent=master
Any changes you make from the command line to the review request are not published. They are only submitted as a draft. So the second step would be to open the review request url and update the necessary info like Title, Reviewer, Bug number etc.
Here are some guidelines for contributing to Apache Lens, to improve quality of the project
You can contribute to improving project documentation by reporting issues in existing documentation or proposing changes. Most of the doc changes are done in existing files under src/site or add you can add new files under src/site or you can use space on confluence for some of the documentation. You can provide the changes for documentation in code similar to code contributions. For updating confluence space, you can request for edit access on dev mailing list for your account.
Below are some guidelines on updating document
The design, architecture and feature documentation needs to be updated in src/site of parent module. The documentation is organized into four menus under the site.
Has main page, getting started page, install and run pages. This is place for all additions/changes required which improves documentation for the whole project
User menu is meant for end user to use the lens as platform. It should be the place to reach end user. The documentation here should not talk about implementation details. For new feature user guide needs to be updated with how end user can use it. If feature is only a server improvement or admin feature, which end user shouldn't care, then this is not the place to add them. Usually api documentation, client side documentation, user level configuration go here.
Configuration pages should be linked from user guide and admin guide with respect to the configuration exposed to them. See Developer FAQ on how to update config docs.
REST api documentation is auto generated through Enunciate. Once the javadoc for the resource api is updated correctly, the REST api doc should get updated.
If a new resource is added in lens-server module, it should be updated in lens-server/enunciate.xml sothat the REST api doc gets generated. If a new module is added with resources and the module pom entry need to updated with enunciate plugin usage and tools/scripts/generate-site-public.sh needs to be updated with site generation and publishing the docs.
Cwiki should be used for documentation that cannot go into code, which is some adhoc documentation. This falls into following main categories
Cwiki should not be used for documentation that is already present in code, which is the following
Lens uses Review board for review requests. If you are interested in reviewing in changes put by other contributors actively look at the review board for requests put up
Some things that are important to check for in patches/review requests
"What do I need to do in order to become a committer?" The simple (though frustrating) answer to this question is, "If you want to become a committer, behave like a committer." If you follow this advice, then rest assured that the PMC will notice, and committership will seek you out rather than the other way around. So besides continuing to contribute high-quality code and tests, there are many other things that you should naturally be undertaking as part of getting deeper into the project's life:
Contributors should join the Lens mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others). Also refer to Apache contributors guide and Apache voting process.
The new doc files can added in src/site of parent module. Or doc change can be done in existing files under src/site. Update the config files and run the TestGenerateConfigDoc test calss for updating the config docs. Once the changes are done, contributor can run mvn site:run, which will start localhost doc server on port 8080, which can opened through browser and doc can be validated.
Add/Delete/Modify the config to the resource config files(Ex: lens-client-default.xml file for Client resource). Run the TestGenerateConfigDoc, which automatically updates the config apt files under src/site.
Resource | Config FileName | Location of config property file |
---|---|---|
Server | lensserver-default.xml | lens-server/src/main/resources/lensserver-default.xml |
Client | lens-client-default.xml | lens-client/src/main/resources/lens-client-default.xml |
Session | lenssession-default.xml | lens-server/src/main/resources/lenssession-default.xml |
Hive Driver | hivedriver-default.xml | lens-driver-hive/src/main/resources/hivedriver-default.xml |
JDBC Driver | jdbcdriver-default.xml | lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml |
Cube | olap-query-conf.xml | lens-cube/src/main/resources/olap-query-conf.xml |
Run the command mvn license:format. This is add license headers for all the files automatically. If some files need to excluded they should be put in excludes section in parent project pom's license-maven-plugin.
Run the command mvn apache-rat:check. If check needs to be excluded for any file, it should be put in excludes section in parent project pom's apache-rat-plugin.
Lens follows three number versioning which is major.minor.revision. If the current release is 2.0.0, the next usual development release will be 2.1.0. If there needs to be separate release on released version and not from development branch (usually critical patch release), it will be 2.0.1. If the next release is not compatible with previous release, then the major version needs to be incremented, then it would become 3.0.0. This way all 2.x.x releases will be compatible with one another. And incompatibility is clearly communicated to users through major version number change.
The jira fix version for all the issues in 2.0.x is called 2.0, and 2.1.x is called 2.1. For patch releases from release branch, the jira fix version can be exact patch release version number.
Lens has two main branches - master and current-release-line. All the day to day development happens on master branch. current-release-line branch is used to make releases. When master branch is ready for release (all improvements/features/bug fixes marked for release are fixed and all tests passing), master will be merged to current-release-line. The version number on master will be incremented to next development version. The only issues that can be cherry-picked into current-release-line till release is rolled are critical/blocker bugs, documentation changes and test case changes. Once all the issues are verified for the release, and release will be triggered from current-release-line.
If a critical release (not pulling code from master) needs to be made, a new branch will be created with release number, by checking out current-release-line branch. And changes will be put on the branch. Once the branch is ready they will merged to current-release-line and released. The changes should be cherry-picked back into master from current-release-line once the release is made and resolving conflicts in master if any. Having two main branches makes all release tags to be created on current-release-line branch and removes the pile up of old and stale branches, which are created by one for each release.
For major version increments, current-release-line will be branched to a a $major.x-line and current-release-line and master will be moved to next major version.
There can be feature branches created from master, if feature is not actively developed in master branch directly. For a feature branch to be created a contirbutor can start discuss thread on dev list for consensus on whether it is required.