blob: b623ae7d9dca8130bf6349e833cb7adba386f4e2 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="https://asterixdb.incubator.apache.org/favicon.ico">
<title>Contributing to AsterixDB</title>
<!-- Bootstrap core CSS -->
<link href="https://asterixdb.incubator.apache.org/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<!-- Custom styles for this template -->
<link href="https://asterixdb.incubator.apache.org/css/theme.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<div class="container theme-showcase" role="main">
<div class="masthead">
<p class="lead">
<a href="https://asterixdb.incubator.apache.org/index.html"><img src="https://asterixdb.incubator.apache.org/img/asterixdb.png" style="height:75px; width:auto; vertical-align:bottom; margin-top:10px;"/></a>
</p>
</div>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://asterixdb.incubator.apache.org/index.html">Overview</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="https://asterixdb.incubator.apache.org/download.html">Download</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Documentation<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">Stable release</li>
<li><a href="http://asterixdb.ics.uci.edu/documentation/index.html">Documentation for 0.8.6<i class="fa fa-external-link fa-sm"></i></a></li>
<li class="divider"></li>
<li class="dropdown-header">Snapshot release</li>
<li><a href="https://asterix-jenkins.ics.uci.edu/job/asterix-test-full/site/asterix-doc/index.html">Documentation for 0.8.7-SNAPSHOT <i class="fa fa-external-link fa-sm"></i></a></li>
</ul>
</li>
<li><a href="https://asterixdb.incubator.apache.org/about.html">About</a></li>
<li><a href="https://asterixdb.incubator.apache.org/community.html">Community</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Contributing <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">For New Contributors</li>
<li><a href="https://asterixdb.incubator.apache.org/dev-setup.html">Development Setup</a></li>
<li class="divider"></li>
<li class="dropdown-header">For Committers</li>
<li><a href="https://asterixdb.incubator.apache.org/pushing.html">Pushing changes</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="row">
<div class="col-md-8 col-centered">
<h2>Contributing to AsterixDB</h2>
<hr />
<ul id="markdown-toc">
<li><a href="#introduction" id="markdown-toc-introduction">Introduction</a></li>
<li><a href="#setting-up-an-asterix-development-environment-in-eclipse" id="markdown-toc-setting-up-an-asterix-development-environment-in-eclipse">Setting up an Asterix Development environment in Eclipse</a> <ul>
<li><a href="#prerequisites" id="markdown-toc-prerequisites">Prerequisites</a></li>
<li><a href="#steps" id="markdown-toc-steps">Steps</a></li>
</ul>
</li>
<li><a href="#signing-up-for-gerrit" id="markdown-toc-signing-up-for-gerrit">Signing Up for Gerrit</a></li>
<li><a href="#configuring-your-local-working-environment-for-gerrit" id="markdown-toc-configuring-your-local-working-environment-for-gerrit">Configuring your local working environment for Gerrit</a> <ul>
<li><a href="#one-time-tasks" id="markdown-toc-one-time-tasks">One-time tasks</a></li>
<li><a href="#once-per-repository-tasks" id="markdown-toc-once-per-repository-tasks">Once-per-repository tasks</a></li>
</ul>
</li>
<li><a href="#making-changes---working-method" id="markdown-toc-making-changes---working-method">Making Changes - working method</a></li>
<li><a href="#making-more-changes" id="markdown-toc-making-more-changes">Making More Changes</a></li>
<li><a href="#using-jenkins-with-gerrit" id="markdown-toc-using-jenkins-with-gerrit">Using Jenkins with Gerrit</a> <ul>
<li><a href="#verification" id="markdown-toc-verification">Verification</a></li>
<li><a href="#retrigggering-builds-and-triggering-builds-manually" id="markdown-toc-retrigggering-builds-and-triggering-builds-manually">Retrigggering builds and triggering builds manually</a></li>
<li><a href="#cross-project-dependencies" id="markdown-toc-cross-project-dependencies">Cross-project Dependencies</a></li>
</ul>
</li>
</ul>
<hr />
<h2 id="introduction">Introduction</h2>
<p>We warmly welcome any contributions to the AsterixDB or related (Hyracks, Pregelix) projects. A great way to start contributing is to pick a bug labelled starter in JIRA and submit a patch for it, to get acquainted with our codebase and development process.</p>
<hr />
<h2 id="setting-up-an-asterix-development-environment-in-eclipse">Setting up an Asterix Development environment in Eclipse</h2>
<h3 id="prerequisites">Prerequisites</h3>
<ul>
<li>A suitable *nix environment (Linux, OSX)</li>
<li>JDK 1.7+</li>
<li>A relatively recent version of Eclipse</li>
</ul>
<h3 id="steps">Steps</h3>
<ol>
<li>
<p>Check out Hyracks and Asterix master in two folders via git in the command line. Assume that the path is <code>$HOME/workspace</code>.</p>
<pre><code> cd $HOME/workspace/
git clone https://github.com/apache/incubator-asterixdb/
git clone https://github.com/apache/incubator-asterixdb-hyracks/
</code></pre>
<p>You will now have <code>$HOME/workspace/incubator-asterixdb/</code> and <code>$HOME/workspace/incubator-asterixdb-hyracks/</code>.</p>
</li>
<li>
<p>Go to the hyracks and install it’s artifacts to the local Maven repository by executing the following commands:</p>
<pre><code> cd $HOME/workspace/hyracks/
mvn install -DskipTests
</code></pre>
</li>
<li>
<p>Go to the asterixdb folder and perform the same action:</p>
<pre><code> cd $HOME/workspace/asterixdb/asterix-maven-plugins/
mvn install -DskipTests
cd $HOME/workspace/asterixdb/
mvn install -DskipTests
</code></pre>
</li>
<li>In Eclipse, import hyracks as an existing Maven Project.
<ul>
<li><code>File -&gt; Import -&gt; Maven -&gt; Existing Maven Projects -&gt; Next</code></li>
<li>Specify the Root directory as <code>$HOME/workspace/hyracks</code> and then click Next until Finish is enabled.</li>
<li>If Eclipse tries to install the <code>m2e</code> (Maven To Eclipse) connector, let it do so.</li>
<li>There might be some plugin errors; however, that is not a big deal. Wait until the job finishes.</li>
<li>Then, click Finish.</li>
</ul>
</li>
<li>Then import asterixdb as an existing Maven Project.
<ul>
<li><code>File -&gt; Import -&gt; Maven -&gt; Existing Maven Projects -&gt; Next</code></li>
<li>Specify root directory as <code>$HOME/workspace/asterixdb</code> and then click Next until Finish is enabled.</li>
<li>Eclipse may try installing <code>m2e</code> or other plugins again; let it do so.</li>
<li>Then, click Finish.</li>
</ul>
</li>
<li>Fix Eclipse’s build path to include compile-time generated sources.
<ul>
<li>Right click the project where a red X mark is shown(e.g. <code>asterix-algebra</code>. Then resolve by applying the following:
<ul>
<li>Right click asterix-algebra. Click Build Path and Configure Build Path. Click Add Folder.</li>
<li>Under the <code>target -&gt; generated sources</code>, check the parent folder of the <code>edu</code> folder and click OK.</li>
<li>For example, if the directory structure is “target - generated-sources - javacc - edu - uci …”, check the javacc directory and click OK. Then X mark will dissapear.</li>
</ul>
</li>
<li>Repeat this step to all projects which show a red X mark except “asterix-fuzzyjoin” and “asterix-transactions”.</li>
<li>It may be the case that only “asterix-algebra” and “asterix-runtime” will require these steps.</li>
</ul>
</li>
<li>Set up Eclipse code formatting rules
<ul>
<li>Download files <a href="http://wiki.asterixdb.googlecode.com/git/AsterixCodeFormatProfile.xml">AsterixCodeFormatProfile.xml</a> <a href="http://wiki.asterixdb.googlecode.com/git/AsterixCleanupFormatProfile.xml">AsterixCleanupFormatProfile.xml</a></li>
<li>Import profiles into Eclipse
<ul>
<li>Preferences -&gt; Java -&gt; Code style -&gt; Formatter -&gt; Import -&gt; Select AsterixCodeFormatProfile.xml</li>
<li>Preferences -&gt; Java -&gt; Code style -&gt; Clean up -&gt; Import -&gt; Select AsterixCleanupFormatProfile.xml</li>
<li>Preferences -&gt; Java -&gt; Editor -&gt; Save actions -&gt; Perform the selected action on save -&gt; Format source code</li>
</ul>
</li>
</ul>
</li>
</ol>
<hr />
<h2 id="signing-up-for-gerrit">Signing Up for Gerrit</h2>
<p>You should only need to perform the following steps once.</p>
<p>Our Gerrit server is <a href="https://asterix-gerrit.ics.uci.edu/">here</a></p>
<ol>
<li>Visit the above URL, and click on “Register” in the upper right.</li>
<li>Gerrit uses OpenID; you may create an account using any OpenID provider, or with a Yahoo! account.</li>
<li>Click on “Sign in with a Yahoo! ID”. You will be taken to a page to log in to Yahoo!.</li>
<li>From there, you will get a page asking you to allow asterix-gerrit.ics.uci.edu to access your email and basic information. Approve this request.</li>
<li>You will be directed back to Gerrit to complete the account signup. Make sure to fill out this page! It is necessary to allow you to push code changes to Gerrit for review.</li>
<li>For “Full Name” and “Preferred Email”, enter what you like. If you would like to register a different email address such as an @uci.edu address, you may do so. This is where Gerrit will send you notifications about code review requests, voting, and so on.</li>
<li>For “Select a unique username”, choose a short alphanumeric ID. This will be your ssh username for git access. Be sure to click “Select Username” to verify that the name is unique and allowed.</li>
<li>Also provide a ssh public key here. There is information on the page on creating one if you do not have one. Click “Add” when done.
* Note that you can create a new ssh public key just for Gerrit if you like; if you do so you will need to modify your .ssh/config file to ensure the right key is selected.</li>
<li>Click “Continue” at the bottom of the page.</li>
<li>
<p>Finally, verify that you have everything set up: From a command-line, type
<code>
ssh -p 29418 username@asterix-gerrit.ics.uci.edu
</code></p>
</li>
<li>You should see</li>
</ol>
<pre><code> **** Welcome to Gerrit Code Review ****
Hi Full Name, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://username@asterix-gerrit.ics.uci.edu:29418/REPOSITORY_NAME.git
</code></pre>
<p>At this point, please send an email to Chris or Ian, specifying the email address of your new account, and ask to be added to the “AsterixDB Devs” group. You may push change proposals to Gerrit, and vote +1/-1 Code Review on any proposals without being in AsterixDB Devs, but you cannot vote +2 on anything to allow a change to be merged.</p>
<hr />
<h2 id="configuring-your-local-working-environment-for-gerrit">Configuring your local working environment for Gerrit</h2>
<h3 id="one-time-tasks">One-time tasks</h3>
<ol>
<li>At the command-line, run the following. Replace “username” with the user name you chose in step 7 above.
<code>
git config --global gerrit.url ssh://username@asterix-gerrit.ics.uci.edu:29418/
</code></li>
<li>Download my “git-gerrit” utility library:
<code>
git clone https://github.com/ceejatec/git-gerrit
</code></li>
<li>Ensure that the <code>git-gerrit/git-gerrit</code> script is on your PATH. You could copy it to somewhere, but it would be best to leave it inside the github clone so you can easily get updates.</li>
</ol>
<h3 id="once-per-repository-tasks">Once-per-repository tasks</h3>
<ol>
<li>
<p>To work on (say) Asterix, first clone the Google Code repository (if you already have a local clone, great!).</p>
<p>git clone https://github.com/apache/incubator-asterixdb</p>
</li>
<li>
<p><code>cd</code> into the clone repo directory, and then run the following command to create the “gerrit” remote.</p>
<p>git gerrit init</p>
</li>
</ol>
<hr />
<h2 id="making-changes---working-method">Making Changes - working method</h2>
<ol>
<li>
<p>When you want to start working on a bug, feature, etc, first make a local <code>git</code> branch. Never work directly on <code>master</code>! <code>master</code> should always be a pure mirror of <code>origin/master</code>, ie, Google Code.</p>
<pre><code> git checkout -b my_branch
</code></pre>
</li>
<li>Make your changes, test them, etc. Feel free to <code>git commit</code> as often as you like.</li>
<li>
<p><strong>Optional</strong>: If you like, you can push your branch up to Google Code, either to share it with others or as a backup. You may do this at whatever point in time you like.</p>
<pre><code> git push origin my_branch
</code></pre>
</li>
<li>
<p>Every so often, you should update your local <code>master</code> mirror, and then merge that onto your working branch. This will prevent your branch from falling too far out of date, and ensure that your code review proposals will merge successfully with <code>master</code>. There are a number of ways to do this, but <code>git-gerrit</code> provides a convenience function:</p>
<pre><code> git gerrit update
</code></pre>
</li>
<li>
<p>When you are ready to submit changes for code review, first ensure that you have committed everything locally that is necessary (<code>git status</code> should report “nothing to commit, working directory clean”). This is also a good time to update (see step 4). Then run:</p>
<pre><code> git gerrit submit
</code></pre>
</li>
<li>This will pop open your editor to invite you to create a good commit message. This will be the single commit message which will be the only one to appear in the project’s master git history. Take the time to make it clear. The editor will contain the log messages of everything you committed on your branch as a reminder, but generally you will want to delete all this and replace it with a comprehensive message. Also: As noted in the initial message, the last line of the buffer will contain a <code>Change-Id</code> field. Do not delete that line! It is used by Gerrit to identify this particular merge proposal.</li>
<li>
<p>When you save your commit message, git-gerrit will push all of the changes from your working branch up to Gerrit. Assuming no errors, you should see output similar to the following:</p>
<pre><code> remote: Resolving deltas: 100% (1/1)
remote: Processing changes: new: 1, refs: 1, done
remote:
remote: New Changes:
remote: http://fulliautomatix.ics.uci.edu:8443/30
remote:
To ssh://ceej@fulliautomatix.ics.uci.edu:29418/ceej-gerrit-test
* [new branch] HEAD -&gt; refs/for/master
</code></pre>
</li>
<li>That URL under “New Changes” is your code review! Send it to others to request reviews.</li>
<li>If you get any negative code reviews and need to make changes, you can just repeat steps 2 - 6 of the working method. Your local branch will still have all the history you put there, if you need to revert changes or look back and see what you did, etc.</li>
<li>When you repeat step 6, you will notice two things: First, git-gerrit keeps the change message for you, including the Change-Id, so you don’t have to re-invent it every time. Second, the output from <code>git gerrit submit</code> will not include the URL of the review this time. I’m not sure why; I wish it did. But if you re-visit the old URL in your browser, you should see an additional “Patch Set” containing your revised changes for people to review.</li>
</ol>
<h2 id="making-more-changes">Making More Changes</h2>
<p>You may have as many feature branches as you want locally, and each may be at any point in the review cycle.</p>
<p>Once you are done with a change (that is, it has been Code Reviewed and approved in Gerrit and merged), it is probably best to start work on the next big thing on a new branch. However, git-gerrit attempts to be smart if you choose to re-use a branch. For example, it should notice if the “current” Change-Id for a branch has been merged to master, and it will create a new Change-Id and a new fresh commit message the next time you run <code>git gerrit submit</code>.</p>
<p>In that case, you may notice that the list of changes on the branch still contains older commits which have been merged. That is due to the unfortunate way Gerrit works; it requires squashing to a single git commit for review, which loses the association with the original commits in your history.</p>
<p>It is also possible that you may want to re-use a branch and git-gerrit fails to notice that the older change has been merged - or perhaps the change was Abandoned on Gerrit and not merged, and you want to continue working on the same branch to create a new proposal. In this case, run
<code>
git gerrit new
</code>
on your branch. This will force git-gerrit to create a new Change-Id and commit message the next time you run <code>git gerrit submit</code>.</p>
<hr />
<h2 id="using-jenkins-with-gerrit">Using Jenkins with Gerrit</h2>
<h3 id="verification">Verification</h3>
<p>As of right now, whenever a patch set is submitted to Gerrit (i.e. whenever a user performs ‘git gerrit submit’) are automatically picked up by Jenkins, which runs <code>mvn verify</code> to test the patch fully. Once the build finishes, Jenkins comments on the patchset and votes with the result (+1 for all tests passing, -1 for anything less). Ideally, and in most cases, verifocation of a patchset reqires no intervention. However there are a few exceptions to this as detailed below.</p>
<h3 id="retrigggering-builds-and-triggering-builds-manually">Retrigggering builds and triggering builds manually</h3>
<h4 id="retriggering">Retriggering</h4>
<p>Occasionally, there are builds in which tests failed, but perhaps not for a reason that has anything to do with the proposed patch’s changes. For example, on occasion the Integration tests can have issues with ports on the build server already being bound. The simple work around to this is to try building again.</p>
<p>One way to perform this is by simply visiting the link that is posted on Gerrit by Jenkins, and hitting the ‘Retrigger’ link on the left-hand side of the page. This will try retesting the build with the exact same parameters as last time, hopefully with a different result.</p>
<h4 id="manual-trigger">Manual Trigger</h4>
<p>Builds of Gerrit patches can also be fully manually triggered from Jenkins. This can be desirable if a change is now dependent on a Hyracks change (via the Topic field feature described below), or if the patch is a draft or is not triggered automatically for any other reason. To manually trigger a build of a patchset, visit the Jenkins front-page, and click the ‘Query and Trigger Gerrit patches’ link. This should link to a page allowing you to manually trigger Gerrit patches. In the search field any query that can be searched in the Gerrit web interface can be used, but the default query of all open patchsets is likely fine. Hit the ‘Search’ button, and then click the checkbox that represents the patch that needs to be built. Then simply click ‘Trigger Selected’ and the patch will start building.</p>
<h3 id="cross-project-dependencies">Cross-project Dependencies</h3>
<p>It is sometimes the case that a change in one related project alters interfaces or expected results that an upstream project relies on. The converse can be true as well, such as an AsterixDB change that needs a Hyracks feature. In these sorts of situations, there is a mechanism to describe to Jenkins this dependenc of one project’s patchset to a particular Hyracks Change, by using the ‘Topic’ field in Gerrit. To utilize
this feature, perform the following steps:</p>
<ol>
<li>First submit the Hyracks change which the upstream (AsterixDB,etc..) change depends on if you have not done so already</li>
<li>In the Hyracks change details on the Gerrit web interface, take note of the refspec in the <em>Download</em> field of the patchset details. It will look something like <code>refs/changes/07/207/1</code>. This is what uniquely identifies the Hyracks change in Gerrit.</li>
<li>Submit the dependent change now, if you have not done so already. In the Gerrit web interface, view the change’s details. In the upper left-hand corner, there will be an empty field in a table, labeled <code>Topic</code>, with a notepad icon right-justified in the second column of the table. Click the notepad Icon, and in the resulting dialog box, enter in the refspec (<code>refs/changes/07/207/1</code>) as the Topic value.</li>
<li>Now, manually trigger the dependent change in Jenkins (see previous section for details)</li>
</ol>
<hr />
</div>
</div>
<hr />
<footer>
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<p>&copy; Copyright 2015 The Apache Software foundation. All Rights Reserved. </p>
<p>Apache AsterixDB, Apache, and the Apache feather logo are trademarks of the Apache Software Foundation</p>
</div>
<div class="col-md-1 text-right">
<img src="https://asterixdb.incubator.apache.org/img/egg-logo.png" style="height:auto; width:200px; vertical-align:bottom;"/>
</div>
</div>
</footer>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://asterixdb.incubator.apache.org/js/bootstrap.min.js"></script>
</body>
</html>