community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1864386 - in /comdev/reporter.apache.org/trunk/site: getjson.py wizard/kibble.py
Date Sun, 04 Aug 2019 14:41:07 GMT
Author: humbedooh
Date: Sun Aug  4 14:41:07 2019
New Revision: 1864386

URL: http://svn.apache.org/viewvc?rev=1864386&view=rev
Log:
Allow JIRA data to be pulled via kibble

Modified:
    comdev/reporter.apache.org/trunk/site/getjson.py
    comdev/reporter.apache.org/trunk/site/wizard/kibble.py

Modified: comdev/reporter.apache.org/trunk/site/getjson.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/getjson.py?rev=1864386&r1=1864385&r2=1864386&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/getjson.py (original)
+++ comdev/reporter.apache.org/trunk/site/getjson.py Sun Aug  4 14:41:07 2019
@@ -381,7 +381,10 @@ if re.match(r"^[-a-zA-Z0-9_.]+$", user):
         try:
             xenv = os.environ.copy()
             del xenv['SCRIPT_NAME']
-            txt = subprocess.check_output(('%s/site/wizard/kibble.py' % RAOHOME_FULL, oproject),
env = xenv)
+            cmd = ('%s/site/wizard/kibble.py' % RAOHOME_FULL, oproject)
+            if jdata and oproject in jdata:
+                cmd += tuple(jdata[oproject][2])
+            txt = subprocess.check_output(cmd, env = xenv)
             kibble = json.loads(txt)
         except:
             pass

Modified: comdev/reporter.apache.org/trunk/site/wizard/kibble.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/kibble.py?rev=1864386&r1=1864385&r2=1864386&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/kibble.py (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/kibble.py Sun Aug  4 14:41:07 2019
@@ -15,9 +15,12 @@ TOKEN = open('%s/data/kibble-token.txt'
 def main():
     form = cgi.FieldStorage()
     project = form.getvalue('project')
+    jira = []
     if not project:
         if len(sys.argv) > 1:
             project = sys.argv[1]
+            for j in sys.argv[2:]:
+                jira.append(j)
         else:    
             project = 'nosuchproject'
     
@@ -72,6 +75,38 @@ def main():
         isc_change = '%u%%' % int((isc_after - isc_before) / (isc_before or 1) * 100)
         
         
+        # JIRA ??
+        # Issues/PRs
+        jio_before = 0
+        jic_before = 0
+        jio_after = 0
+        jic_after = 0
+        for j in jira:
+            issues = requests.post('https://demo.kibble.apache.org/api/issue/issues',
+                      headers = {
+                        'Content-Type': 'application/json',
+                        'Kibble-Token': TOKEN,
+                      },
+                      json = {
+                        "quick":True,
+                        "interval": "week",
+                        "subfilter":"/browse/" + j
+                        }
+                     ).json();
+            after = [x for x in issues['timeseries'] if x['date'] > BEFORE]
+            before = [x for x in issues['timeseries'] if x['date'] <= BEFORE]
+        
+            for month in before:
+                jio_before += month.get('issues opened', 0)
+                jic_before += month.get('issues closed', 0)
+            for month in after:
+                jio_after += month.get('issues opened', 0)
+                jic_after += month.get('issues closed', 0)
+                
+        jio_change = '%u%%' % int((jio_after - jio_before) / (jio_before or 1) * 100)
+        jic_change = '%u%%' % int((jic_after - jic_before) / (jic_before or 1) * 100)
+        
+        
         # Commits
         commits = requests.post('https://demo.kibble.apache.org/api/code/commits',
                   headers = {
@@ -165,6 +200,20 @@ def main():
                     'closed': isc_change,
                 }
             },
+            'jira': {
+                'before': {
+                    'opened': jio_before,
+                    'closed': jic_before,
+                },
+                'after': {
+                    'opened': jio_after,
+                    'closed': jic_after,
+                },
+                'change': {
+                    'opened': jio_change,
+                    'closed': jic_change,
+                }
+            },
             'commits' : {
                 'before': {
                     'commits': cmt_before,



Mime
View raw message