Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/155730

Change subject: Write out meta.json with metadata about each build
......................................................................

Write out meta.json with metadata about each build

Change-Id: I8426f70f270d2cf2815512bb668d524cc5bb363e
---
M src/build.py
1 file changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/wikipedia-android-builds 
refs/changes/30/155730/1

diff --git a/src/build.py b/src/build.py
index 4700fde..4c1e3aa 100755
--- a/src/build.py
+++ b/src/build.py
@@ -1,6 +1,7 @@
 #!/data/project/wikipedia-android-builds/bin/python
 import os
 import sh
+import json
 from datetime import datetime
 
 # Environment variables required for mvn to build app
@@ -20,16 +21,24 @@
 commit_count = int(sh.git('rev-list', 'HEAD..origin/master', '--count'))
 
 if commit_count != 0:
+    meta = {
+        'commit_count': commit_count
+    }
+
     # Create the output directory
     run_slug = 'master-%s' % datetime.now().isoformat()
     run_path = os.path.expanduser('~/public_html/runs/%s' % run_slug)
     sh.mkdir('-p', run_path)
 
+    meta['commits'] = str(sh.git('log', 'HEAD..origin/master', 
'--oneline')).split('\n')
+
     sh.git('reset', '--hard', 'origin/master')
 
-    commit_hash = sh.git('rev-parse', 'HEAD')
+    commit_hash = str(sh.git('rev-parse', 'HEAD')).strip()
 
-    print 'Starting build for %s, with %s new commits' % (commit_hash.strip(), 
commit_count)
+    meta['commit_hash'] = commit_hash
+
+    print 'Starting build for %s, with %s new commits' % (commit_hash, 
commit_count)
     # Run in side the app folder, since we can't run
     # instrumentation tests
     sh.cd(os.path.join(REPO_PATH, 'wikipedia'))
@@ -40,6 +49,8 @@
 
     sh.cp('target/wikipedia.apk', run_path)
 
+    json.dump(open(os.path.join(run_path, 'meta.json'), 'w'), meta)
+
     latest_path = os.path.expanduser('~/public_html/runs/latest')
     sh.rm('-f', latest_path)
     sh.ln('-s', run_path, latest_path)

-- 
To view, visit https://gerrit.wikimedia.org/r/155730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8426f70f270d2cf2815512bb668d524cc5bb363e
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/wikipedia-android-builds
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to