blob: d6f0b5bcbc36905f911cec598bb9fb32a8536bd4 [file] [log] [blame]
Ian Maxon3dffc852015-07-13 20:17:09 -07001<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
8 <meta name="description" content="">
9 <meta name="author" content="">
Ian Maxonf84cb812015-12-07 15:09:45 -080010 <link rel="icon" href="favicon.ico">
Ian Maxon3dffc852015-07-13 20:17:09 -070011
12 <title>Contributing to AsterixDB</title>
13
14 <!-- Bootstrap core CSS -->
Ian Maxonf84cb812015-12-07 15:09:45 -080015 <link href="css/bootstrap.min.css" rel="stylesheet">
Ian Maxon3dffc852015-07-13 20:17:09 -070016 <!-- Bootstrap theme -->
17
18 <!-- Custom styles for this template -->
Ian Maxonf84cb812015-12-07 15:09:45 -080019 <link href="css/theme.css" rel="stylesheet">
Ian Maxon3dffc852015-07-13 20:17:09 -070020
21 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
22 <!--[if lt IE 9]>
23 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
24 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
25 <![endif]-->
26 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
27 </head>
28
29 <div class="container theme-showcase" role="main">
Till Westmann00f9bf22016-03-14 13:59:27 -070030 <div class="masthead">
31 <p class="lead">
32 <a href="index.html">
33 <img src="img/asterixdb_tm.png" style="height:75px; width:auto; vertical-align:bottom; margin-top:10px;"/>
34 </a>
35 </p>
36 </div>
Ian Maxon3dffc852015-07-13 20:17:09 -070037
Till Westmann00f9bf22016-03-14 13:59:27 -070038 <nav class="navbar navbar-default">
Ian Maxon3dffc852015-07-13 20:17:09 -070039 <div class="container">
40 <div class="navbar-header">
41 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
42 <span class="sr-only">Toggle navigation</span>
43 <span class="icon-bar"></span>
44 <span class="icon-bar"></span>
45 <span class="icon-bar"></span>
46 </button>
Ian Maxonf84cb812015-12-07 15:09:45 -080047 <a class="navbar-brand" href="index.html">Overview</a>
Ian Maxon3dffc852015-07-13 20:17:09 -070048 </div>
49 <div class="navbar-collapse collapse">
50 <ul class="nav navbar-nav">
Ian Maxonf84cb812015-12-07 15:09:45 -080051 <li><a href="download.html">Download</a></li>
Ian Maxona9643c82015-09-01 11:15:57 -100052 <li class="dropdown">
53 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Documentation<span class="caret"></span></a>
54 <ul class="dropdown-menu" role="menu">
55 <li class="dropdown-header">Stable release</li>
Ian Maxon1befeb12021-07-16 12:40:15 -070056 <li><a href="docs/0.9.7/index.html">Documentation for 0.9.7<i class="fa fa-external-link fa-sm"></i></a></li>
Ian Maxona9643c82015-09-01 11:15:57 -100057 <li class="divider"></li>
58 <li class="dropdown-header">Snapshot release</li>
Ian Maxon1befeb12021-07-16 12:40:15 -070059 <li><a href="https://ci.apache.org/projects/asterixdb/index.html">Documentation for 0.9.7-SNAPSHOT <i class="fa fa-external-link fa-sm"></i></a></li>
Ian Maxon79af4a72018-11-02 17:06:39 -070060 <li class="divider"></li>
61 <li class="dropdown-header">Tutorial for SQL Users</li>
62 <li><a href="files/SQL_Book.pdf">Don Chamberlin's SQL++ for SQL Users<i class="fa fa-external-link fa-sm"></i></a></li>
Ian Maxona9643c82015-09-01 11:15:57 -100063 </ul>
64 </li>
Ian Maxonf84cb812015-12-07 15:09:45 -080065 <li><a href="about.html">About</a></li>
Till Westmann2a321022016-04-08 08:18:14 -070066 <li class="dropdown">
67 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Community<span class="caret"></span></a>
68 <ul class="dropdown-menu" role="menu">
69 <li><a href="community.html">Mailing Lists</a></li>
70 <li><a href="community.html#irc">IRC</a></li>
71 <li><a href="community.html#asterixdb-team">Team</a></li>
72 <li><a href="https://issues.apache.org/jira/browse/ASTERIXDB">Issue Tracker</a></li>
73 </ul>
74 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -070075 <li class="dropdown">
Michael Blowf93d7f52016-10-07 14:36:30 -040076 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Development<span class="caret"></span></a>
Ian Maxon3dffc852015-07-13 20:17:09 -070077 <ul class="dropdown-menu" role="menu">
78 <li class="dropdown-header">For New Contributors</li>
Ian Maxonf84cb812015-12-07 15:09:45 -080079 <li><a href="dev-setup.html">Development Setup</a></li>
Ian Maxon3dffc852015-07-13 20:17:09 -070080 <li class="divider"></li>
81 <li class="dropdown-header">For Committers</li>
Ian Maxonf84cb812015-12-07 15:09:45 -080082 <li><a href="pushing.html">Pushing changes</a></li>
83 <li><a href="site.html">Editing this site</a></li>
Michael Blowf93d7f52016-10-07 14:36:30 -040084 <li class="dropdown-header">Extensions</li>
85 <li><a href="extension.html">Extending AsterixDB</a></li>
Ian Maxon3dffc852015-07-13 20:17:09 -070086 </ul>
87 </li>
88 </ul>
Till Westmann00f9bf22016-03-14 13:59:27 -070089 <ul class="nav navbar-nav navbar-right">
90 <li class="dropdown">
91 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"
92 style="padding-right: 30px">
93 <img src="img/feather.png" style="height:20px"/>Apache Software Foundation<span class="caret"/>
94 </a>
95 <ul class="dropdown-menu dropdown-menu-right" role="menu">
96 <li><a href="http://www.apache.org/"><b>ASF Homepage</b></a></li>
97 <li><a href="http://www.apache.org/licenses/">License</a></li>
98 <li><a href="http://www.apache.org/foundation/sponsorship.html">Donate</a></li>
99 <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
100 <li><a href="http://www.apache.org/security/">Security</a></li>
101 </ul>
102 </li>
103 </ul>
Ian Maxon3dffc852015-07-13 20:17:09 -0700104 </div><!--/.nav-collapse -->
105 </div>
106 </nav>
107
108
Till Westmann00f9bf22016-03-14 13:59:27 -0700109 <div class="row">
Ian Maxon3dffc852015-07-13 20:17:09 -0700110<div class="col-md-8 col-centered">
111<h2>Contributing to AsterixDB</h2>
112<hr />
113
114<ul id="markdown-toc">
115 <li><a href="#introduction" id="markdown-toc-introduction">Introduction</a></li>
Ian Maxonacb58492015-10-16 19:12:28 -0700116 <li><a href="#master-snapshots" id="markdown-toc-master-snapshots">Master snapshots</a> <ul>
Till Westmanne9aae952017-02-10 22:57:46 -0800117 <li><a href="#server-package" id="markdown-toc-server-package">Server Package</a></li>
Ian Maxonacb58492015-10-16 19:12:28 -0700118 </ul>
119 </li>
Ian Maxon7bb6ace2016-07-19 11:53:43 -0700120 <li><a href="#setting-up-an-asterix-development-environment" id="markdown-toc-setting-up-an-asterix-development-environment">Setting up an Asterix Development environment</a> <ul>
Ian Maxon3dffc852015-07-13 20:17:09 -0700121 <li><a href="#prerequisites" id="markdown-toc-prerequisites">Prerequisites</a></li>
122 <li><a href="#steps" id="markdown-toc-steps">Steps</a></li>
123 </ul>
124 </li>
125 <li><a href="#signing-up-for-gerrit" id="markdown-toc-signing-up-for-gerrit">Signing Up for Gerrit</a></li>
126 <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>
127 <li><a href="#one-time-tasks" id="markdown-toc-one-time-tasks">One-time tasks</a></li>
128 <li><a href="#once-per-repository-tasks" id="markdown-toc-once-per-repository-tasks">Once-per-repository tasks</a></li>
129 </ul>
130 </li>
131 <li><a href="#making-changes---working-method" id="markdown-toc-making-changes---working-method">Making Changes - working method</a></li>
132 <li><a href="#making-more-changes" id="markdown-toc-making-more-changes">Making More Changes</a></li>
133 <li><a href="#using-jenkins-with-gerrit" id="markdown-toc-using-jenkins-with-gerrit">Using Jenkins with Gerrit</a> <ul>
134 <li><a href="#verification" id="markdown-toc-verification">Verification</a></li>
135 <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>
Ian Maxon3dffc852015-07-13 20:17:09 -0700136 </ul>
137 </li>
138</ul>
139
140<hr />
141
142<h2 id="introduction">Introduction</h2>
Till Westmanndadc9b72016-04-26 17:24:34 -0700143<p>We warmly welcome any contributions to the Apache AsterixDB™ or related (Hyracks, Pregelix) projects.
Till Westmann00f9bf22016-03-14 13:59:27 -0700144A 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>
Ian Maxon3dffc852015-07-13 20:17:09 -0700145
146<hr />
147
Ian Maxonacb58492015-10-16 19:12:28 -0700148<h2 id="master-snapshots">Master snapshots</h2>
149<p>If you are a developer simply looking for a snapshot of the latest development version of AsterixDB to test out your application that is based on top of AsterixDB, snapshots from the latest successful push to our master branch are available below. These are non ASF-release, automatic builds.</p>
150
Till Westmanne9aae952017-02-10 22:57:46 -0800151<h3 id="server-package">Server Package</h3>
Ian Maxon1befeb12021-07-16 12:40:15 -0700152<p><a class="btn btn-md btn-warning" href="https://asterix-jenkins.ics.uci.edu/job/asterix-integration-tests/lastSuccessfulBuild/org.apache.asterix$asterix-server/artifact/org.apache.asterix/asterix-server/0.9.7-SNAPSHOT/asterix-server-0.9.7-SNAPSHOT-binary-assembly.zip" role="button">Download AsterixDB 0.9.7-SNAPSHOT <i class="fa fa-download fa-lg"></i> </a></p>
Ian Maxonacb58492015-10-16 19:12:28 -0700153
154<hr />
155
Ian Maxon7bb6ace2016-07-19 11:53:43 -0700156<h2 id="setting-up-an-asterix-development-environment">Setting up an Asterix Development environment</h2>
Ian Maxon3dffc852015-07-13 20:17:09 -0700157
158<h3 id="prerequisites">Prerequisites</h3>
159<ul>
160 <li>A suitable *nix environment (Linux, OSX)</li>
Ian Maxon1bd67772015-11-12 16:14:20 -0800161 <li>JDK 1.8+</li>
Till Westmann0cb533a2016-07-12 22:17:50 -0700162 <li>Maven 3.3.9 or greater</li>
Till Westmannad8974b2016-07-21 18:12:01 -0700163 <li>Eclipse Juno (or later) or IntelliJ IDEA 15.0 (or later)</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700164</ul>
165
166<h3 id="steps">Steps</h3>
167
Ian Maxon7bb6ace2016-07-19 11:53:43 -0700168<h4 id="general-setup">General setup</h4>
169
Ian Maxon3dffc852015-07-13 20:17:09 -0700170<ol>
Till Westmann0cf36632015-12-08 21:57:33 -0800171 <li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700172 <p>Check out AsterixDB master in one folder via git in the command line. Assume that the path is <code>$HOME/workspace</code>.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700173
Till Westmann0cb533a2016-07-12 22:17:50 -0700174 <pre><code> git clone https://github.com/apache/asterixdb/
Ian Maxon3dffc852015-07-13 20:17:09 -0700175</code></pre>
176
Taewoo Kim12b53a22016-07-08 14:02:15 -0700177 <p>You will now have <code>$HOME/workspace/asterixdb/</code>.</p>
Till Westmann0cf36632015-12-08 21:57:33 -0800178 </li>
179 <li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700180 <p>Go to the asterixdb folder and install it’s artifacts to the local Maven repository by executing the following commands:</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700181
Till Westmann0cb533a2016-07-12 22:17:50 -0700182 <pre><code> cd asterixdb/
183 mvn install -DskipTests
Ian Maxon3dffc852015-07-13 20:17:09 -0700184</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800185 </li>
Ian Maxon7bb6ace2016-07-19 11:53:43 -0700186</ol>
187
188<h4 id="intellij-idea-ide-setup">IntelliJ IDEA IDE Setup</h4>
189
190<ol>
191 <li>In IntelliJ IDEA, import asterixdb as an existing Maven Project.
192 <ul>
193 <li><code>File -&gt; New -&gt; Project from existing sources</code>, or `Import project…’ when on a new install</li>
194 <li>Then, select the ‘pom.xml’ in the root of the checked out git repository.</li>
195 <li>The default options for import should suffice, so just click <code>Next</code></li>
196 <li>Also click <code>Next</code> when selecting for profiles and versions</li>
197 <li>On the JDK Selection screen, be sure to select a JDK &gt; 1.8, OpenJDK or Oracle is fine.</li>
198 <li>Give IntelliJ some time to import the Maven project and its dependencies</li>
199 <li>Once everything is finished, you should see ‘asterixdb’ and ‘hyracks-fullstack’ modules in the “Project” view.</li>
200 </ul>
201 </li>
202 <li>Set up IntelliJ code formatting rules
203 <ul>
204 <li>Download files <a href="https://cwiki.apache.org/confluence/download/attachments/61322291/AsterixCodeFormatProfile.xml">AsterixCodeFormatProfile.xml</a>
205 <a href="https://cwiki.apache.org/confluence/download/attachments/61322291/AsterixCleanupFormatProfile.xml">AsterixCleanupFormatProfile.xml</a></li>
206 <li>Import profiles into IntelliJ</li>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200207 </ul>
208 <ul>
Ian Maxon7bb6ace2016-07-19 11:53:43 -0700209 <li><code>File -&gt; Settings -&gt; Editor -&gt; Code Style -&gt; Java</code></li>
210 <li>Then, click the <code>Manage...</code> button</li>
211 <li>Click <code>Import</code> and import the <code>AsterixCodeFormatProfile.xml</code> as an Eclipse XML profile.</li>
212 </ul>
213 </li>
214</ol>
215
216<h4 id="eclipse-ide-setup">Eclipse IDE Setup</h4>
217
218<ol>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700219 <li>In Eclipse, import asterixdb as an existing Maven Project.
Ian Maxon3dffc852015-07-13 20:17:09 -0700220 <ul>
221 <li><code>File -&gt; Import -&gt; Maven -&gt; Existing Maven Projects -&gt; Next</code></li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700222 <li>Specify the Root directory as <code>asterixdb</code> and then click Next until Finish is enabled.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700223 <li>If Eclipse tries to install the <code>m2e</code> (Maven To Eclipse) connector, let it do so.</li>
224 <li>There might be some plugin errors; however, that is not a big deal. Wait until the job finishes.</li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700225 <li>Then, click Finish. Restart Eclipse if asked to do so.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700226 </ul>
227 </li>
228 <li>Fix Eclipse’s build path to include compile-time generated sources.
229 <ul>
230 <li>Right click the project where a red X mark is shown(e.g. <code>asterix-algebra</code>. Then resolve by applying the following:
231 <ul>
232 <li>Right click asterix-algebra. Click Build Path and Configure Build Path. Click Add Folder.</li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700233 <li>Under the <code>target -&gt; generated sources</code>, check the parent folder of the <code>org</code> folder and click OK.</li>
Ian Maxon4baed872015-10-06 19:01:17 -0700234 <li>For example, if the directory structure is “target - generated-sources - javacc - org - apache …”, check the javacc directory and click OK. Then X mark will dissapear.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700235 </ul>
236 </li>
237 <li>Repeat this step to all projects which show a red X mark except “asterix-fuzzyjoin” and “asterix-transactions”.</li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700238 <li>It may be the case that only “asterix-algebra” and “asterix-external-data” will require these steps.</li>
239 <li>If you see “plugin execution not covered by lifecycle configuration” errors such as this one - “Plugin execution not covered by lifecycle configuration: org.apache.asterix:asterix-test-datagenerator-maven-plugin:0.8.9-SNAPSHOT:generate-testdata (execution: replace-template-data, phase: process-test-resources)”, try to resolve it using the quick fix feature. You can call this feature by right click on the error and select “quick fix”. And then choose “Mark goal generate-testdata as ignored in Eclipse build in Eclipse preferences”.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700240 </ul>
241 </li>
242 <li>Set up Eclipse code formatting rules
243 <ul>
Till Westmannad8974b2016-07-21 18:12:01 -0700244 <li>Download files <a href="https://cwiki.apache.org/confluence/download/attachments/61322291/AsterixCodeFormatProfile.xml">AsterixCodeFormatProfile.xml</a>
245 <a href="https://cwiki.apache.org/confluence/download/attachments/61322291/AsterixCleanupFormatProfile.xml">AsterixCleanupFormatProfile.xml</a></li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700246 <li>Import profiles into Eclipse
247 <ul>
248 <li>Preferences -&gt; Java -&gt; Code style -&gt; Formatter -&gt; Import -&gt; Select AsterixCodeFormatProfile.xml</li>
249 <li>Preferences -&gt; Java -&gt; Code style -&gt; Clean up -&gt; Import -&gt; Select AsterixCleanupFormatProfile.xml</li>
250 <li>Preferences -&gt; Java -&gt; Editor -&gt; Save actions -&gt; Perform the selected action on save -&gt; Format source code</li>
251 </ul>
252 </li>
253 </ul>
254 </li>
Taewoo Kim12b53a22016-07-08 14:02:15 -0700255 <li>
256 <p>Lastly, go to the asterixdb folder and execute following command again. This is required since Eclipse might have cleaned the projects and rebuilt the them without creating all necessary classes. Currently, some of the class files can be only built using mvn command.</p>
257
Till Westmann0cb533a2016-07-12 22:17:50 -0700258 <pre><code> cd asterixdb/
259 mvn install -DskipTests
Taewoo Kim12b53a22016-07-08 14:02:15 -0700260</code></pre>
261 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700262</ol>
263
264<hr />
265
266<h2 id="signing-up-for-gerrit">Signing Up for Gerrit</h2>
267
Ian Maxon4baed872015-10-06 19:01:17 -0700268<p>First, to contribute patches to AsterixDB, you should have an ICLA on file with the Apache Software Foundation.
269For details see the ASF website <a href="https://www.apache.org/dev/new-committers-guide.html#cla">here</a>
270You should only need to perform the following steps once.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700271
272<p>Our Gerrit server is <a href="https://asterix-gerrit.ics.uci.edu/">here</a></p>
273
274<ol>
275 <li>Visit the above URL, and click on “Register” in the upper right.</li>
276 <li>Gerrit uses OpenID; you may create an account using any OpenID provider, or with a Yahoo! account.</li>
277 <li>Click on “Sign in with a Yahoo! ID”. You will be taken to a page to log in to Yahoo!.</li>
Till Westmannad8974b2016-07-21 18:12:01 -0700278 <li>From there, you will get a page asking you to allow <code>asterix-gerrit.ics.uci.edu</code> to access your email and basic information. Approve this request.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700279 <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>
280 <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>
281 <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>
282 <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.
Till Westmannad8974b2016-07-21 18:12:01 -0700283Note 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 <code>.ssh/config</code> file to ensure the right key is selected.</li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700284 <li>Click “Continue” at the bottom of the page.</li>
285 <li>
Till Westmannad8974b2016-07-21 18:12:01 -0700286 <p>Finally, verify that you have everything set up: From a command-line, type</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700287
Till Westmannad8974b2016-07-21 18:12:01 -0700288 <pre><code>ssh -p 29418 username@asterix-gerrit.ics.uci.edu
Ian Maxon3dffc852015-07-13 20:17:09 -0700289</code></pre>
Till Westmannad8974b2016-07-21 18:12:01 -0700290 </li>
291 <li>
292 <p>You should see</p>
293
294 <pre><code>**** Welcome to Gerrit Code Review ****
295
296Hi Full Name, you have successfully connected over SSH.
297
298Unfortunately, interactive shells are disabled.
299To clone a hosted Git repository, use:
300
301git clone ssh://username@asterix-gerrit.ics.uci.edu:29418/REPOSITORY_NAME.git
302</code></pre>
303 </li>
304</ol>
Ian Maxon3dffc852015-07-13 20:17:09 -0700305
306<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>
307
308<hr />
309
310<h2 id="configuring-your-local-working-environment-for-gerrit">Configuring your local working environment for Gerrit</h2>
311
312<h3 id="one-time-tasks">One-time tasks</h3>
313
314<ol>
Till Westmannad8974b2016-07-21 18:12:01 -0700315 <li>
316 <p>At the command-line, run the following. Replace “username” with the user name you chose in step 7 above.</p>
317
318 <pre><code>git config --global gerrit.url ssh://username@asterix-gerrit.ics.uci.edu:29418/
319</code></pre>
320 </li>
321 <li>
322 <p>Download my “git-gerrit” utility library:</p>
323
324 <pre><code>git clone https://github.com/ceejatec/git-gerrit
325</code></pre>
326 </li>
327 <li>
328 <p>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.</p>
329 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700330</ol>
331
332<h3 id="once-per-repository-tasks">Once-per-repository tasks</h3>
333
334<ol>
Till Westmann0cf36632015-12-08 21:57:33 -0800335 <li>
336 <p>To work on (say) Asterix, first clone the GitHub mirror or the ASF repository (if you already have a local clone, great!), e.g.</p>
337
Till Westmann0cb533a2016-07-12 22:17:50 -0700338 <pre><code>git clone https://github.com/apache/asterixdb
339</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800340 </li>
341 <li>
342 <p><code>cd</code> into the clone repo directory, and then run the following command to create the “gerrit” remote.</p>
343
Till Westmann0cb533a2016-07-12 22:17:50 -0700344 <pre><code>git gerrit init
345</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800346 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700347</ol>
348
349<hr />
350
351<h2 id="making-changes---working-method">Making Changes - working method</h2>
352
353<ol>
Till Westmann0cf36632015-12-08 21:57:33 -0800354 <li>
Till Westmannad8974b2016-07-21 18:12:01 -0700355 <p>When you want to start working on a bug, feature, etc, first make a local <code>git</code> branch. Never work directly on
Till Westmann0cf36632015-12-08 21:57:33 -0800356 <code>master</code>! <code>master</code> should always be a pure mirror of <code>origin/master</code>, i.e., the GitHub mirror or the ASF repository.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700357
Till Westmann0cb533a2016-07-12 22:17:50 -0700358 <pre><code>git checkout -b my_branch
Ian Maxon3dffc852015-07-13 20:17:09 -0700359</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800360 </li>
361 <li>
362 <p>Make your changes, test them, etc. Feel free to <code>git commit</code> as often as you like.</p>
363 </li>
364 <li>
365 <p><strong>Optional</strong>: If you like, you can push your branch up to another git repository (e.g. in your own GitHub account), either to share it with others or as a backup. You may do this at whatever point in time you like.</p>
366 </li>
367 <li>
368 <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>
Ian Maxonf84cb812015-12-07 15:09:45 -0800369
Till Westmann0cb533a2016-07-12 22:17:50 -0700370 <pre><code>git gerrit update
Ian Maxon3dffc852015-07-13 20:17:09 -0700371</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800372 </li>
373 <li>
374 <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>
Ian Maxon3dffc852015-07-13 20:17:09 -0700375
Till Westmann0cb533a2016-07-12 22:17:50 -0700376 <pre><code>git gerrit submit
Ian Maxon3dffc852015-07-13 20:17:09 -0700377</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800378 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700379 <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>
Till Westmann0cf36632015-12-08 21:57:33 -0800380 <li>
381 <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>
Ian Maxon3dffc852015-07-13 20:17:09 -0700382
Till Westmann0cb533a2016-07-12 22:17:50 -0700383 <pre><code>remote: Resolving deltas: 100% (1/1)
384remote: Processing changes: new: 1, refs: 1, done
385remote:
386remote: New Changes:
387remote: http://fulliautomatix.ics.uci.edu:8443/30
388remote:
389To ssh://ceej@fulliautomatix.ics.uci.edu:29418/ceej-gerrit-test
390 * [new branch] HEAD -&gt; refs/for/master
Ian Maxon3dffc852015-07-13 20:17:09 -0700391</code></pre>
Till Westmann0cf36632015-12-08 21:57:33 -0800392 </li>
Ian Maxon3dffc852015-07-13 20:17:09 -0700393 <li>That URL under “New Changes” is your code review! Send it to others to request reviews.</li>
394 <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>
395 <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>
396</ol>
397
398<h2 id="making-more-changes">Making More Changes</h2>
399
400<p>You may have as many feature branches as you want locally, and each may be at any point in the review cycle.</p>
401
402<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>
403
404<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>
405
Till Westmannad8974b2016-07-21 18:12:01 -0700406<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</p>
407
408<pre><code>git gerrit new
409</code></pre>
410
411<p>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>
Ian Maxon3dffc852015-07-13 20:17:09 -0700412
413<hr />
414
415<h2 id="using-jenkins-with-gerrit">Using Jenkins with Gerrit</h2>
416
417<h3 id="verification">Verification</h3>
418
Till Westmannad8974b2016-07-21 18:12:01 -0700419<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.
420Once the build finishes, Jenkins comments on the patchset and votes with the result (+1 for all tests passing, -1 for anything less).
421Ideally, and in most cases, verification of a patchset reqires no intervention.
422However there are a few exceptions to this as detailed below.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700423
424<h3 id="retrigggering-builds-and-triggering-builds-manually">Retrigggering builds and triggering builds manually</h3>
425
426<h4 id="retriggering">Retriggering</h4>
Till Westmannad8974b2016-07-21 18:12:01 -0700427<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.
428For example, on occasion the Integration tests can have issues with ports on the build server already being bound.
429The simple work around to this is to try building again.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700430
Till Westmannad8974b2016-07-21 18:12:01 -0700431<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.
432This will try retesting the build with the exact same parameters as last time, hopefully with a different result.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700433
434<h4 id="manual-trigger">Manual Trigger</h4>
Till Westmannad8974b2016-07-21 18:12:01 -0700435<p>Builds of Gerrit patches can also be fully manually triggered from Jenkins.
436This can be desirable if the patch is a draft or is not triggered automatically for any other reason.
437To manually trigger a build of a patchset, visit the Jenkins front-page, and click the ‘Query and Trigger Gerrit patches’ link.
438This should link to a page allowing you to manually trigger Gerrit patches.
439In 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.
440Hit the ‘Search’ button, and then click the checkbox that represents the patch that needs to be built.
441Then simply click ‘Trigger Selected’ and the patch will start building.</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700442
Ian Maxon3dffc852015-07-13 20:17:09 -0700443<hr />
444
445</div>
446</div>
447
448
Till Westmann00f9bf22016-03-14 13:59:27 -0700449 <hr/>
Ian Maxon3dffc852015-07-13 20:17:09 -0700450
Till Westmann00f9bf22016-03-14 13:59:27 -0700451 <footer>
452 <div class="row">
Till Westmann00f9bf22016-03-14 13:59:27 -0700453 <div class="col-md-9 col-centered text-center">
454 <p/>
455 <p>&copy; Copyright 2016 The Apache Software foundation. All Rights Reserved. </p>
456 <p>Apache AsterixDB, the Apache AsterixDB logo, Apache, and the Apache feather logo are trademarks of the
457 Apache Software Foundation</p>
Ian Maxon3dffc852015-07-13 20:17:09 -0700458 </div>
Till Westmann00f9bf22016-03-14 13:59:27 -0700459 </div>
460 </footer>
461 </div> <!-- /container -->
Ian Maxon3dffc852015-07-13 20:17:09 -0700462
463 <!-- Bootstrap core JavaScript
464 ================================================== -->
465 <!-- Placed at the end of the document so the pages load faster -->
466 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
Ian Maxonf84cb812015-12-07 15:09:45 -0800467 <script src="js/bootstrap.min.js"></script>
Ian Maxon3dffc852015-07-13 20:17:09 -0700468 </body>
469</html>