Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/
Date: Thu, 01 Sep 2022 14:57:09
Message-Id: 1662044202.0d19b4627eba83ffccadc753105b5cbdf53a68e7.zorry@gentoo
1 commit: 0d19b4627eba83ffccadc753105b5cbdf53a68e7
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 1 14:56:42 2022 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 1 14:56:42 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=0d19b462
7
8 Add Bug ID for Irc reporter and nice titel
9
10 Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>
11
12 buildbot_gentoo_ci/config/reporters.py | 7 ++++---
13 buildbot_gentoo_ci/steps/bugs.py | 24 ++++++++++++++++--------
14 buildbot_gentoo_ci/steps/logs.py | 16 ++++++++++++++++
15 3 files changed, 36 insertions(+), 11 deletions(-)
16
17 diff --git a/buildbot_gentoo_ci/config/reporters.py b/buildbot_gentoo_ci/config/reporters.py
18 index 9832305..bd55037 100644
19 --- a/buildbot_gentoo_ci/config/reporters.py
20 +++ b/buildbot_gentoo_ci/config/reporters.py
21 @@ -8,10 +8,11 @@ from buildbot.reporters.message import MessageFormatter
22
23 from buildbot_gentoo_ci.reporters import irc
24 irc_template = '''{% set resultsList = ["\x0303SUCCESS", "\x0308WARNINGS", "\x0304FAILURE"] %}\
25 -{{ "\x02" }}{{ build['properties']['cpv'][0] }}{{ "\x02" }} {{ "\x0303" }}repo/{{ projects }}:{{ build['properties']['branch'][0] }}{{ "\x03" }} \
26 +{{ "\x02" }}{{ build['properties']['cpv'][0] }}{{ "\x02" }} {{ "\x0303" }}Repo:{{ projects }}:{{ build['properties']['branch'][0] }}{{ "\x03" }} \
27 {{ build['properties']['revision'][0]|truncate(10, True) }} {{ "\x0302" }}{{ build['properties']['owners'][0][0] }}{{ "\x03" }} \
28 -{{ build['properties']['event'][0] }} {{ projects }}:{{ build['properties']['project_data'][0]['name'] }} \
29 -{{ "\x02" }}{{ "Build: "}}{{ resultsList[build['results']] }}{{ "\x03" }}{{ "\x02" }} {{ "\x0312" }}{{ build_url }}{{ "\x03" }}\
30 +{{ "\x0306" }}{{ build['properties']['event'][0] }}{{ "\x03" }} {{ projects }}:{{ build['properties']['project_data'][0]['name'] }} \
31 +{{ "\x02" }}{{ "Build: "}}{{ resultsList[build['results']] }}{{ "\x03" }}{{ "\x02" }} {{ "\x0312" }}{{ build_url }}{{ "\x03" }} \
32 +{% if build['properties']['bgo'][0]['match'] is true %}{{ "\x0311" }}Bugid: {{build['properties']['bgo'][0]['id']}}{{ "\x03" }}{% endif %}\
33 '''
34
35 def ircGenerators():
36
37 diff --git a/buildbot_gentoo_ci/steps/bugs.py b/buildbot_gentoo_ci/steps/bugs.py
38 index 27b1388..801fc98 100644
39 --- a/buildbot_gentoo_ci/steps/bugs.py
40 +++ b/buildbot_gentoo_ci/steps/bugs.py
41 @@ -87,20 +87,28 @@ class GetBugs(BuildStep):
42 yield log.addStdout('Open Bugs\n')
43 match = False
44 for bug in buglist:
45 - yield log.addStdout('Bug: ' + str(bug['id']) + ' Summary: ' + bug['summary'] +'\n')
46 - if re.search(self.getProperty('error_dict')['title_issue'][:20], bug['summary']):
47 - print('Bug found')
48 - print(bug)
49 + yield log.addStdout(f"Bug: {str(bug['id'])} Summary: {bug['summary']}\n")
50 + # we splite the lines to lists and try to match the words
51 + matches = 0
52 + match_search_text = list(self.getProperty('error_dict')['title_issue'].split())
53 + match_bug_text = list(bug['summary'].split())
54 + #FIXME: add check for cp
55 + for match_word in match_search_text:
56 + if match_word in match_bug_text:
57 + matches = matches + 1
58 + if matches >= 10:
59 + print(f"Bug: {str(bug['id'])} Summary: {bug['summary']}")
60 match = {}
61 + match['match'] = True
62 match['id'] = bug['id']
63 match['summary'] = bug['summary']
64 + yield log.addStdout(f"Line to match: {self.getProperty('error_dict')['title_issue']}\n")
65 if match:
66 - yield log.addStdout('Match bug found\n')
67 - yield log.addStdout('Bug: ' + str(match['id']) + ' Summary: ' + match['summary'] +'\n')
68 + yield log.addStdout('Match bug: YES\n')
69 + yield log.addStdout(f"Bug: {str(match['id'])} Summary: {match['summary']}\n")
70 self.setProperty("bgo", match, 'bgo')
71 return
72 - yield log.addStdout('NO Match bug found\n')
73 - self.setProperty("bgo", False, 'bgo')
74 + yield log.addStdout('Match bug: NO\n')
75
76 @defer.inlineCallbacks
77 def run(self):
78
79 diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py
80 index 164bb24..57f9394 100644
81 --- a/buildbot_gentoo_ci/steps/logs.py
82 +++ b/buildbot_gentoo_ci/steps/logs.py
83 @@ -91,6 +91,7 @@ class SetupPropertys(BuildStep):
84 else:
85 log_cpv = self.getProperty('cpv')
86 self.setProperty("log_cpv", log_cpv, 'log_cpv')
87 + self.setProperty("bgo", dict( match=False), 'bgo')
88 self.descriptionDone = 'Runing log checker on ' + log_cpv
89 return SUCCESS
90
91 @@ -333,6 +334,19 @@ class MakeIssue(BuildStep):
92 yield log.addStdout(log_cpv['full_logname'] + '\n')
93 yield log.addStdout('world.log' + '\n')
94
95 + def getNiceErrorLine(self, line):
96 + # strip away hex addresses, loong path names, line and time numbers and other stuff
97 + # https://github.com/toralf/tinderbox/blob/main/bin/job.sh#L467
98 + # FIXME: Add the needed line when needed
99 + if re.search(': line', line):
100 + line = re.sub(r"\d", "<snip>", line)
101 + # Shorten the path
102 + if line.startswith('/usr/'):
103 + line = line.replace(os.path.split(line.split(' ', 1)[0])[0], '/...')
104 + if re.search(': \d:\d: ', line):
105 + line = re.sub(r":\d:\d: ", ": ", line)
106 + return line
107 +
108 def ClassifyIssue(self):
109 # get the title for the issue
110 text_issue_list = []
111 @@ -344,8 +358,10 @@ class MakeIssue(BuildStep):
112 # add the issue error
113 if text_issue_list != []:
114 self.error_dict['title_issue'] = text_issue_list[0].replace('*', '').strip()
115 + self.error_dict['title_issue_nice'] = self.getNiceErrorLine(text_issue_list[0].replace('*', '').strip())
116 else:
117 self.error_dict['title_issue'] = 'title_issue : None'
118 + self.error_dict['title_nice'] = 'title_issue : None'
119 self.error_dict['title_phase'] = 'failed in '+ self.error_dict['phase']
120 #set the error title
121 self.error_dict['title'] = self.error_dict['title_phase'] + ' - ' + self.error_dict['title_issue']