Merge lp:~1chb1n/ubuntu-openstack-ci/mpc-pb into lp:ubuntu-openstack-ci

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 39
Proposed branch: lp:~1chb1n/ubuntu-openstack-ci/mpc-pb
Merge into: lp:ubuntu-openstack-ci
Diff against target: 113 lines (+31/-9)
4 files modified
common/osci_utils.py (+17/-0)
mp_comment.py (+10/-3)
populate/mappings.yaml (+1/-1)
populate/mp-comment.tmpl (+3/-5)
To merge this branch: bzr merge lp:~1chb1n/ubuntu-openstack-ci/mpc-pb
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Approve
Review via email: mp+238954@code.launchpad.net

Description of the change

add pastebin posting of test log, reduce mp comment length

To post a comment you must log in.
41. By Ryan Beisner

toggle sandbox off

Revision history for this message
Ryan Beisner (1chb1n) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/osci_utils.py'
2--- common/osci_utils.py 2014-10-16 21:53:26 +0000
3+++ common/osci_utils.py 2014-10-20 19:29:22 +0000
4@@ -10,6 +10,7 @@
5 import random
6 import string
7 import distro_info
8+import subprocess
9 from jinja2 import Environment, FileSystemLoader
10 from launchpadlib.launchpad import Launchpad
11
12@@ -424,3 +425,19 @@
13 if new_status:
14 mp.setStatus(status=new_status)
15 mp.lp_save()
16+
17+
18+def pb_it(file_name):
19+ '''pastebin a filename, return pastebin url
20+ '''
21+ if os.path.isfile(file_name):
22+ pb_url = subprocess.Popen(['pastebinit', file_name],
23+ stdout=subprocess.PIPE).stdout
24+ pb_line = pb_url.readline().rstrip()
25+ if pb_line[:4] == 'http':
26+ return pb_line
27+ else:
28+ return 'pastebin not avail., cmd error'
29+ else:
30+ logging.error('file not found: {}'.format(file_name))
31+ return 'pastebin not avail., file error'
32
33=== modified file 'mp_comment.py'
34--- mp_comment.py 2014-10-20 15:26:48 +0000
35+++ mp_comment.py 2014-10-20 19:29:22 +0000
36@@ -131,6 +131,7 @@
37 logging.info('Constructing results blurb')
38 summary = []
39 results = []
40+ pbs = {}
41 something_ran = False
42 for trigger_test, tt_attrs in conf_map['mp-trigger-tests'].iteritems():
43 # look for try touchfiles
44@@ -156,12 +157,17 @@
45 logging.info('Found {} results file(s)'.format(trigger_test))
46 # handle results files
47 for res_file in res_files:
48+ pbs[res_file] = osci_utils.pb_it(res_file)
49+ logging.debug('pb for {}: {}'.format(res_file, pbs[res_file]))
50 llimit = conf_map['mp-conf']['line-limit']
51 _line = ('\n{} Results (max last {} lines) from \n{}:'.format(
52 trigger_test.upper(), llimit, res_file))
53 results.append(_line)
54 with open(res_file) as _file:
55 res_lines = [f_line.rstrip() for f_line in _file][-llimit:]
56+ _line = ('Full {} result: {}'.format(trigger_test,
57+ pbs[res_file]))
58+ res_lines.append(_line)
59 results.extend(res_lines)
60 else:
61 _line = ('\n{} Results not found.'.format(trigger_test.upper()))
62@@ -192,15 +198,16 @@
63 _line = (' {} OK: believed to pass, but you should '
64 'confirm results'.format(trigger_test.upper()))
65 summary.append(_line)
66+#
67+ logging.debug('pbs: {}'.format(pbs))
68
69 if not something_ran:
70 logging.error('It appears that nothing ran here.')
71 sys.exit(1)
72
73 # add summary and results to context for template
74- contexts[0]['results_summary'] = '\n'.join(summary)
75- contexts[0]['results_summary'] += '\n'
76- contexts[0]['results_summary'] += '\n'.join(results)
77+ contexts[0]['summary'] = '\n'.join(summary)
78+ contexts[0]['results'] = '\n'.join(results)
79
80 # create mp comment file
81 logging.info('Creating mp-comment file')
82
83=== modified file 'populate/mappings.yaml'
84--- populate/mappings.yaml 2014-10-20 15:26:48 +0000
85+++ populate/mappings.yaml 2014-10-20 19:29:22 +0000
86@@ -14,7 +14,7 @@
87 mp-state-file: 'mp-state'
88
89 mp-conf:
90- line-limit: 12
91+ line-limit: 4
92 # post ALL MP comments to this alternate MP when mp-comment-sandbox is True
93 # ie. contain the noise during osci dev
94 mp-comment-sandbox: False
95
96=== modified file 'populate/mp-comment.tmpl'
97--- populate/mp-comment.tmpl 2014-10-20 15:26:48 +0000
98+++ populate/mp-comment.tmpl 2014-10-20 19:29:22 +0000
99@@ -1,11 +1,9 @@
100 UOSCI bot says: This MP triggered a test on the Ubuntu OSCI system.
101
102 {{JOB_NAME}} {{BUILD_DISPLAY_NAME}}
103+{{summary}}
104+
105 Build: {{BUILD_URL}}
106 MP: {{MP_TRIGGER}}
107 Proposed: {{MP_SRC_BR}}
108-
109-Results summary:
110-{{results_summary}}
111-----------
112-{{JENKINS_URL}} is currently in development on a private network, though public results are planned.
113+{{results}}

Subscribers

People subscribed via source and target branches