You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2015/10/29 20:00:30 UTC

incubator-asterixdb git commit: ASTERIXDB-1153: Determine build information at runtime

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 742aba85e -> 6059af36c


ASTERIXDB-1153: Determine build information at runtime

Very simple API. Just do a GET against /admin/version and get all of the build-time git info in JSON.

Change-Id: Ie392eb0cdbd25f2f4679fba12aae4c7a496e9637
Reviewed-on: https://asterix-gerrit.ics.uci.edu/468
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/6059af36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/6059af36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/6059af36

Branch: refs/heads/master
Commit: 6059af36c044a476fb03541a4f2b5f67a270b16b
Parents: 742aba8
Author: Ian Maxon <im...@apache.org>
Authored: Wed Oct 28 21:58:01 2015 -0700
Committer: Ian Maxon <im...@apache.org>
Committed: Thu Oct 29 11:57:13 2015 -0700

----------------------------------------------------------------------
 .gitignore                                      |   1 +
 .../api/common/AsterixAppRuntimeContext.java    |   8 ++
 .../api/http/servlet/RESTAPIServlet.java        |   4 +-
 .../api/http/servlet/VersionAPIServlet.java     |  53 +++++++++
 .../bootstrap/CCApplicationEntryPoint.java      |  11 +-
 .../api/http/servlet/VersionAPIServletTest.java | 116 +++++++++++++++++++
 .../common/config/AsterixBuildProperties.java   | 114 ++++++++++++++++++
 .../config/AsterixPropertiesAccessor.java       |  18 ++-
 .../config/IAsterixPropertiesProvider.java      |   2 +
 .../asterix/om/util/AsterixAppContextInfo.java  |  10 +-
 pom.xml                                         |  28 +++++
 11 files changed, 358 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 189af35..b75b189 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ bin/
 .idea/
 asterix.ipr
 asterix.iws
+git.properties

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixAppRuntimeContext.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixAppRuntimeContext.java b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixAppRuntimeContext.java
index 35afd8b..2a15384 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixAppRuntimeContext.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixAppRuntimeContext.java
@@ -27,6 +27,7 @@ import org.apache.asterix.common.api.IAsterixAppRuntimeContext;
 import org.apache.asterix.common.config.AsterixCompilerProperties;
 import org.apache.asterix.common.config.AsterixExternalProperties;
 import org.apache.asterix.common.config.AsterixFeedProperties;
+import org.apache.asterix.common.config.AsterixBuildProperties;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
 import org.apache.asterix.common.config.AsterixPropertiesAccessor;
 import org.apache.asterix.common.config.AsterixStorageProperties;
@@ -95,6 +96,7 @@ public class AsterixAppRuntimeContext implements IAsterixAppRuntimeContext, IAst
     private AsterixStorageProperties storageProperties;
     private AsterixTransactionProperties txnProperties;
     private AsterixFeedProperties feedProperties;
+    private AsterixBuildProperties buildProperties;
 
     private AsterixThreadExecutor threadExecutor;
     private DatasetLifecycleManager indexLifecycleManager;
@@ -118,6 +120,7 @@ public class AsterixAppRuntimeContext implements IAsterixAppRuntimeContext, IAst
         storageProperties = new AsterixStorageProperties(ASTERIX_PROPERTIES_ACCESSOR);
         txnProperties = new AsterixTransactionProperties(ASTERIX_PROPERTIES_ACCESSOR);
         feedProperties = new AsterixFeedProperties(ASTERIX_PROPERTIES_ACCESSOR);
+        buildProperties = new AsterixBuildProperties(ASTERIX_PROPERTIES_ACCESSOR);
     }
 
     public void initialize() throws IOException, ACIDException, AsterixException {
@@ -249,6 +252,11 @@ public class AsterixAppRuntimeContext implements IAsterixAppRuntimeContext, IAst
     }
 
     @Override
+    public AsterixBuildProperties getBuildProperties() {
+        return buildProperties;
+    }
+
+    @Override
     public List<IVirtualBufferCache> getVirtualBufferCaches(int datasetID) {
         return indexLifecycleManager.getVirtualBufferCaches(datasetID);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
index 7db0c94..e13ac8e 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
@@ -53,9 +53,9 @@ import org.apache.hyracks.client.dataset.HyracksDataset;
 abstract class RESTAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
 
-    private static final String HYRACKS_CONNECTION_ATTR = "org.apache.asterix.HYRACKS_CONNECTION";
+    public static final String HYRACKS_CONNECTION_ATTR = "org.apache.asterix.HYRACKS_CONNECTION";
 
-    private static final String HYRACKS_DATASET_ATTR = "org.apache.asterix.HYRACKS_DATASET";
+    public static final String HYRACKS_DATASET_ATTR = "org.apache.asterix.HYRACKS_DATASET";
 
     /**
      * Initialize the Content-Type of the response, and construct a

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
new file mode 100644
index 0000000..f98bb06
--- /dev/null
+++ b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/VersionAPIServlet.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.api.http.servlet;
+
+import org.apache.asterix.api.common.SessionConfig;
+import org.apache.asterix.common.config.AsterixBuildProperties;
+import org.apache.asterix.common.config.AsterixPropertiesAccessor;
+import org.apache.asterix.hyracks.bootstrap.CCApplicationEntryPoint;
+import org.apache.asterix.om.util.AsterixAppContextInfo;
+import org.apache.hadoop.http.HttpServer;
+import org.json.JSONObject;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+public class VersionAPIServlet extends HttpServlet {
+
+    public static final String ASTERIX_BUILD_PROP_ATTR = "org.apache.asterix.PROPS";
+
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        ServletContext context = getServletContext();
+        AsterixAppContextInfo props = (AsterixAppContextInfo) context.getAttribute(ASTERIX_BUILD_PROP_ATTR);
+        Map<String, String> buildProperties = props.getBuildProperties().getAllProps();
+        JSONObject responseObject = new JSONObject(buildProperties);
+        response.setCharacterEncoding("utf-8");
+        PrintWriter responseWriter =  response.getWriter();
+        responseWriter.write(responseObject.toString());
+        response.setStatus(HttpServletResponse.SC_OK);
+        responseWriter.flush();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java b/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index 1ad34da..11ea546 100644
--- a/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -36,6 +36,8 @@ import org.apache.asterix.api.http.servlet.QueryResultAPIServlet;
 import org.apache.asterix.api.http.servlet.QueryStatusAPIServlet;
 import org.apache.asterix.api.http.servlet.ShutdownAPIServlet;
 import org.apache.asterix.api.http.servlet.UpdateAPIServlet;
+import org.apache.asterix.api.http.servlet.VersionAPIServlet;
+import org.apache.asterix.common.config.AsterixBuildProperties;
 import org.apache.asterix.common.api.AsterixThreadFactory;
 import org.apache.asterix.common.config.AsterixExternalProperties;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
@@ -57,6 +59,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint {
     private static final Logger LOGGER = Logger.getLogger(CCApplicationEntryPoint.class.getName());
 
     private static final String HYRACKS_CONNECTION_ATTR = "org.apache.asterix.HYRACKS_CONNECTION";
+    private static final String ASTERIX_BUILD_PROP_ATTR = "org.apache.asterix.PROPS";
 
     private Server webServer;
     private Server jsonAPIServer;
@@ -89,7 +92,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint {
         AsterixExternalProperties externalProperties = AsterixAppContextInfo.getInstance().getExternalProperties();
         setupWebServer(externalProperties);
         webServer.start();
-
+        AsterixBuildProperties buildProperties = AsterixAppContextInfo.getInstance().getBuildProperties();
         setupJSONAPIServer(externalProperties);
         jsonAPIServer.start();
 
@@ -160,6 +163,9 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint {
 
         IHyracksClientConnection hcc = getNewHyracksClientConnection();
         context.setAttribute(HYRACKS_CONNECTION_ATTR, hcc);
+        context.setAttribute(ASTERIX_BUILD_PROP_ATTR, AsterixAppContextInfo.getInstance());
+
+
 
         jsonAPIServer.setHandler(context);
         context.addServlet(new ServletHolder(new QueryAPIServlet()), "/query");
@@ -170,6 +176,7 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint {
         context.addServlet(new ServletHolder(new AQLAPIServlet()), "/aql");
         context.addServlet(new ServletHolder(new ConnectorAPIServlet()), "/connector");
         context.addServlet(new ServletHolder(new ShutdownAPIServlet()), "/admin/shutdown");
+        context.addServlet(new ServletHolder(new VersionAPIServlet()), "/admin/version");
     }
 
     private void setupFeedServer(AsterixExternalProperties externalProperties) throws Exception {
@@ -186,4 +193,4 @@ public class CCApplicationEntryPoint implements ICCApplicationEntryPoint {
 
         // add paths here
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java b/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
new file mode 100644
index 0000000..25ba2a6
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/api/http/servlet/VersionAPIServletTest.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.api.http.servlet;
+
+import junit.framework.Assert;
+import org.apache.asterix.common.config.AsterixBuildProperties;
+import org.apache.asterix.om.util.AsterixAppContextInfo;
+import org.apache.asterix.test.runtime.ExecutionTest;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.junit.Test;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+
+@SuppressWarnings("deprecation")
+public class VersionAPIServletTest {
+
+    @Test
+    public void testGet() throws Exception {
+        // Starts test asterixdb cluster.
+        ExecutionTest.setUp();
+
+        // Configures a test version api servlet.
+        VersionAPIServlet servlet = spy(new VersionAPIServlet());
+        ServletConfig mockServletConfig = mock(ServletConfig.class);
+        servlet.init(mockServletConfig);
+        Map<String, String> propMap = new HashMap<String, String>();
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        PrintWriter outputWriter = new PrintWriter(outputStream);
+
+        // Creates mocks.
+        ServletContext mockContext = mock(ServletContext.class);
+        AsterixAppContextInfo mockCtx = mock(AsterixAppContextInfo.class);
+        HttpServletRequest mockRequest = mock(HttpServletRequest.class);
+        IHyracksClientConnection mockHcc = mock(IHyracksClientConnection.class);
+        HttpServletResponse mockResponse = mock(HttpServletResponse.class);
+        AsterixBuildProperties mockProperties = mock(AsterixBuildProperties.class);
+
+        // Sets up mock returns.
+        when(servlet.getServletContext()).thenReturn(mockContext);
+        when(mockResponse.getWriter()).thenReturn(outputWriter);
+        when(mockContext.getAttribute(RESTAPIServlet.HYRACKS_CONNECTION_ATTR)).thenReturn(mockHcc);
+        when(mockContext.getAttribute(VersionAPIServlet.ASTERIX_BUILD_PROP_ATTR)).thenReturn(mockCtx);
+        when(mockCtx.getBuildProperties()).thenReturn(mockProperties);
+        when(mockProperties.getAllProps()).thenReturn(propMap);
+
+        propMap.put("git.build.user.email","foo@bar.baz");
+        propMap.put("git.build.host","fulliautomatix");
+        propMap.put("git.dirty","true");
+        propMap.put("git.remote.origin.url","git@github.com:apache/incubator-asterixdb.git");
+        propMap.put("git.closest.tag.name","asterix-0.8.7-incubating");
+        propMap.put("git.commit.id.describe-short","asterix-0.8.7-incubating-19-dirty");
+        propMap.put("git.commit.user.email","foo@bar.baz");
+        propMap.put("git.commit.time","21.10.2015 @ 23:36:41 PDT");
+        propMap.put("git.commit.message.full","ASTERIXDB-1045: fix log file reading during recovery\n\nChange-Id: Ic83ee1dd2d7ba88180c25f4ec6c7aa8d0a5a7162\nReviewed-on: https://asterix-gerrit.ics.uci.edu/465\nTested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>");
+        propMap.put("git.build.version","0.8.8-SNAPSHOT");
+        propMap.put("git.commit.message.short","ASTERIXDB-1045: fix log file reading during recovery");
+        propMap.put("git.commit.id.abbrev","e1dad19");
+        propMap.put("git.branch","foo/bar");
+        propMap.put("git.build.user.name","Asterix");
+        propMap.put("git.closest.tag.commit.count","19");
+        propMap.put("git.commit.id.describe","asterix-0.8.7-incubating-19-ge1dad19-dirty");
+        propMap.put("git.commit.id","e1dad1984640517366a7e73e323c9de27b0676f7");
+        propMap.put("git.tags","");
+        propMap.put("git.build.time","22.10.2015 @ 17:11:07 PDT");
+        propMap.put("git.commit.user.name","Obelix");
+
+        // Calls VersionAPIServlet.formResponseObject.
+        servlet.doGet(mockRequest, mockResponse);
+
+        // Constructs the actual response.
+        JSONTokener tokener = new JSONTokener(new InputStreamReader(
+                new ByteArrayInputStream(outputStream.toByteArray())));
+        JSONObject actualResponse = new JSONObject(tokener);
+        JSONObject expectedResponse = new JSONObject(propMap);
+
+        // Checks the response contains all the expected keys.
+        Assert.assertEquals(actualResponse.toString(),expectedResponse.toString());
+
+        // Tears down the asterixdb cluster.
+        ExecutionTest.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
new file mode 100644
index 0000000..e065bec
--- /dev/null
+++ b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixBuildProperties.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.common.config;
+
+import java.util.Map;
+import java.util.Properties;
+
+public class AsterixBuildProperties extends AbstractAsterixProperties {
+
+    public AsterixBuildProperties(AsterixPropertiesAccessor accessor) {
+        super(accessor);
+    }
+
+    public String getUserEmail() {
+        return accessor.getProperty("git.build.user.email", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getBuildHost() {
+        return accessor.getProperty("git.build.host", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getDirty() {
+        return accessor.getProperty("git.dirty", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getRemoteOriginUrl() {
+        return accessor.getProperty("git.remote.origin.url", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getClosestTagName() {
+        return accessor.getProperty("git.closest.tag.name", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitIdDescribeShort() {
+        return accessor.getProperty("git.commit.id.describe-short", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitUserEmail() {
+        return accessor.getProperty("git.commit.user.email", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitTime() {
+        return accessor.getProperty("git.commit.time", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitMessage() {
+        return accessor.getProperty("git.commit.message.full", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getBuildVersion() {
+        return accessor.getProperty("git.build.version", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitMessageShort() {
+        return accessor.getProperty("git.commit.message.short", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getShortCommitId() {
+        return accessor.getProperty("git.commit.id.abbrev", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getBranch() {
+        return accessor.getProperty("git.branch", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getBuildUserName() {
+        return accessor.getProperty("git.build.user.name", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getClosestTagCommitCount() {
+        return accessor.getProperty("git.closest.tag.commit.count", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitIdDescribe() {
+        return accessor.getProperty("git.commit.id.describe", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitId() {
+        return accessor.getProperty("git.commit.id", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getTags() {
+        return accessor.getProperty("git.tags", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getBuildTime() {
+        return accessor.getProperty("git.build.time", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+
+    public String getCommitUserName() {
+        return accessor.getProperty("git.commit.user.name", "", PropertyInterpreters.getStringPropertyInterpreter());
+    }
+    public Map<String, String> getAllProps(){
+        return accessor.getBuildProperties();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
index 76dfe4f..647b032 100644
--- a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
+++ b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
@@ -20,14 +20,16 @@ package org.apache.asterix.common.config;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.Properties;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -50,6 +52,7 @@ public class AsterixPropertiesAccessor {
     private final Map<String, String> coredumpConfig;
     private final Map<String, Property> asterixConfigurationParams;
     private final Map<String, String> transactionLogDirs;
+    private final Map<String, String> asterixBuildProperties;
 
     public AsterixPropertiesAccessor() throws AsterixException {
         String fileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
@@ -96,6 +99,13 @@ public class AsterixPropertiesAccessor {
         for (TransactionLogDir txnLogDir : asterixConfiguration.getTransactionLogDir()) {
             transactionLogDirs.put(txnLogDir.getNcId(), txnLogDir.getTxnLogDirPath());
         }
+        Properties p = new Properties();
+        try {
+            p.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
+            asterixBuildProperties = new HashMap<String, String>((Map)p);
+        } catch(IOException e) {
+            throw new AsterixException(e);
+        }
 
     }
 
@@ -127,6 +137,10 @@ public class AsterixPropertiesAccessor {
         return coredumpConfig;
     }
 
+    public Map<String, String> getBuildProperties(){
+        return asterixBuildProperties;
+    }
+
     public void putCoredumpPaths(String nodeId, String coredumpPath) {
         if (coredumpConfig.containsKey(nodeId)) {
             throw new IllegalStateException("Cannot override value for coredump path");

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-common/src/main/java/org/apache/asterix/common/config/IAsterixPropertiesProvider.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/config/IAsterixPropertiesProvider.java b/asterix-common/src/main/java/org/apache/asterix/common/config/IAsterixPropertiesProvider.java
index d7ff0eb..93c58be 100644
--- a/asterix-common/src/main/java/org/apache/asterix/common/config/IAsterixPropertiesProvider.java
+++ b/asterix-common/src/main/java/org/apache/asterix/common/config/IAsterixPropertiesProvider.java
@@ -30,4 +30,6 @@ public interface IAsterixPropertiesProvider {
     public AsterixExternalProperties getExternalProperties();
     
     public AsterixFeedProperties getFeedProperties();
+
+    AsterixBuildProperties getBuildProperties();
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/asterix-om/src/main/java/org/apache/asterix/om/util/AsterixAppContextInfo.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/util/AsterixAppContextInfo.java b/asterix-om/src/main/java/org/apache/asterix/om/util/AsterixAppContextInfo.java
index 9f076f2..8f9f577 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/util/AsterixAppContextInfo.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/util/AsterixAppContextInfo.java
@@ -23,6 +23,7 @@ import java.util.logging.Logger;
 import org.apache.asterix.common.config.AsterixCompilerProperties;
 import org.apache.asterix.common.config.AsterixExternalProperties;
 import org.apache.asterix.common.config.AsterixFeedProperties;
+import org.apache.asterix.common.config.AsterixBuildProperties;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
 import org.apache.asterix.common.config.AsterixPropertiesAccessor;
 import org.apache.asterix.common.config.AsterixStorageProperties;
@@ -52,6 +53,7 @@ public class AsterixAppContextInfo implements IAsterixApplicationContextInfo, IA
     private AsterixStorageProperties storageProperties;
     private AsterixTransactionProperties txnProperties;
     private AsterixFeedProperties feedProperties;
+    private AsterixBuildProperties buildProperties;
 
     private IHyracksClientConnection hcc;
 
@@ -67,6 +69,7 @@ public class AsterixAppContextInfo implements IAsterixApplicationContextInfo, IA
         INSTANCE.txnProperties = new AsterixTransactionProperties(propertiesAccessor);
         INSTANCE.feedProperties = new AsterixFeedProperties(propertiesAccessor);
         INSTANCE.hcc = hcc;
+        INSTANCE.buildProperties = new AsterixBuildProperties(propertiesAccessor);
         Logger.getLogger("org.apache").setLevel(INSTANCE.externalProperties.getLogLevel());
     }
 
@@ -113,7 +116,12 @@ public class AsterixAppContextInfo implements IAsterixApplicationContextInfo, IA
     public AsterixFeedProperties getFeedProperties() {
         return feedProperties;
     }
-    
+
+    @Override
+    public AsterixBuildProperties getBuildProperties() {
+        return buildProperties;
+    }
+
     public IHyracksClientConnection getHcc() {
         return hcc;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6059af36/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9f02d63..1923fd0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -179,6 +179,34 @@
                    <compilerArgument>-Xlint:all</compilerArgument>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>pl.project13.maven</groupId>
+                <artifactId>git-commit-id-plugin</artifactId>
+                <version>2.2.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>revision</goal>
+                         </goals>
+                    </execution>
+                </executions>
+
+                <configuration>
+                    <!--
+                        If you'd like to tell the plugin where your .git directory is,
+                        use this setting, otherwise we'll perform a search trying to
+                        figure out the right directory. It's better to add it explicite IMHO.
+                    -->
+                    <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
+                    <!-- this is false by default, forces the plugin to generate the git.properties file -->
+                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
+
+                    <!-- The path for the to be generated properties file, it's relative to ${project.basedir} -->
+                    <generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
+                </configuration>
+
+            </plugin>
+            <!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION -->
         </plugins>
         <pluginManagement>
             <plugins>