Skip to content

Commit

Permalink
Adding a way to see the git SHA from the website (#1956)
Browse files Browse the repository at this point in the history
* Adding a way to see the git SHA from the website

* Fixing py3 bug
  • Loading branch information
mistercrunch authored Jan 12, 2017
1 parent 470a6e9 commit 0ce7fc1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ app.db
node_modules
npm-debug.log
yarn.lock
superset/assets/version_info.json
24 changes: 23 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import imp
import os
import subprocess
import json
from setuptools import setup, find_packages

Expand All @@ -9,6 +9,28 @@
with open(PACKAGE_FILE) as package_file:
version_string = json.load(package_file)['version']


def get_git_sha():
try:
s = str(subprocess.check_output(['git', 'rev-parse', 'HEAD']))
return s.strip()
except:
pass

GIT_SHA = get_git_sha()
version_info = {
'GIT_SHA': GIT_SHA,
'version': version_string,
}
print("-==-" * 15)
print("VERSION: " + version_string)
print("GIT SHA: " + GIT_SHA)
print("-==-" * 15)

with open(os.path.join(PACKAGE_DIR, 'version_info.json'), 'w') as version_file:
json.dump(version_info, version_file)


setup(
name='superset',
description=(
Expand Down
5 changes: 5 additions & 0 deletions superset/templates/appbuilder/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
{% include 'appbuilder/navbar_menu.html' %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/static/assets/version_info.json" title="Version info">
<i class="fa fa-code-fork"></i> &nbsp;
</a>
</li>
<li>
<a href="https://github.com/airbnb/superset" title="Superset's Github">
<i class="fa fa-github"></i> &nbsp;
Expand Down

0 comments on commit 0ce7fc1

Please sign in to comment.