Fix ER bot to report back to gerrit with bug/error report

Change-Id: Ic6d4c7a5714151e630100e6daf342c830061c10b
This commit is contained in:
frenzyfriday 2021-08-23 15:10:07 +02:00
parent d87a5b7077
commit 2e5cb3b08f
8 changed files with 25 additions and 24 deletions

View File

@ -10,16 +10,16 @@
[ircbot]
# nick=${IRC_NICK}
# pass=${IRC_PASS}
server=irc.freenode.net
server=irc.oftc.net
port=6667
channel_config=recheckwatchbot.yaml
# log_config=${LOG_CONFIG}
[gerrit]
# host=${GERRIT_HOST}
# user=${GERRIT_USER}
# query_file=${GERRIT_QUERY_FILE}
# key=data/id_rsa
host=${GERRIT_HOST}
user=${GERRIT_USER}
query_file=${GERRIT_QUERY_FILE}
key=/root/.ssh/id_rsa
[data_source]
es_url=${ES_URL}

View File

@ -1,5 +1,5 @@
channels:
openstack-neutron:
oooq:
projects:
# elastic-recheck doesn't allow to limit reports to patches from a specific repo,
# so let's at least scope to bugs that neutron team acknowledged ownership for
@ -10,7 +10,7 @@ channels:
# we may revisit it once elastic-recheck learns how to limit the scope of reports
# to particular repositories
- positive
openstack-qa:
oooq:
projects:
- all
events:

View File

@ -4,7 +4,7 @@ nick=RecheckWatchBot
pass=
server=irc.freenode.net
port=6667
channel_config=/home/mtreinish/elasticRecheck/recheckwatchbot.yaml
channel_config=data/recheckwatchbot.yaml
[recheckwatch]
#Any project that has a job that matches this regex will have all their
@ -13,10 +13,10 @@ jobs_re=dsvm
ci_username=jenkins
[gerrit]
user=treinish
user=os-tripleo-ci
host=review.opendev.org
query_file=/home/mtreinish/elasticRecheck/queries
key=/home/mtreinish/.ssh/id_rsa
query_file=/opt/elastic-recheck/queries
key=/root/.ssh/id_rsa
[data_source]
es_url=http://logstash.openstack.org:80/elasticsearch

View File

@ -215,8 +215,8 @@ class RecheckWatch(threading.Thread):
self.msgs,
debug=not self.commenting)
except er.ResultTimedOut as e:
self.log.warning(e.message)
self._read(msg=e.message)
self.log.warning(e.args[0])
self._read(msg=e.args[0])
except Exception:
self.log.exception("Uncaught exception processing event.")

View File

@ -30,18 +30,18 @@ DEFAULTS = {
'DB_URI': 'mysql+pymysql://query:query@logstash.openstack.org/subunit2sql',
'server_password': '',
'CI_USERNAME': 'jenkins',
'JOBS_RE': 'dsvm',
'JOBS_RE': '.*',
'PID_FN': '/var/run/elastic-recheck/elastic-recheck.pid',
'INDEX_FORMAT': r'logstash-%Y.%m.%d',
'GERRIT_QUERY_FILE': 'queries',
'GERRIT_HOST': 'review.opendev.org',
'GERRIT_HOST': 'review.rdoproject.org',
'GERRIT_USER': None,
'IRC_LOG_CONFIG': '',
'IRC_SERVER': "irc.freenode.net",
'IRC_SERVER': "irc.oftc.net",
'IRC_PORT': "6667",
'IRC_PASS': "",
'IRC_SERVER_PASSWORD': "",
'IRC_NICK': "",
'IRC_SERVER_PASSWORD': "erbot",
'IRC_NICK': "erbot",
}
# Not all teams actively used elastic recheck for categorizing their

View File

@ -225,7 +225,7 @@ class Stream(object):
# these items. It's orthoginal to non voting ES searching.
if " (non-voting)" in line:
continue
m = re.search(r"- ([\w-]+)\s*(http://\S+)\s*:\s*FAILURE", line)
m = re.search(r"([\w-]+)\s*(https?://\S+)\s*:\s*FAILURE", line)
if m:
failed_tests.append(FailJob(m.group(1), m.group(2)))
return failed_tests
@ -257,9 +257,9 @@ class Stream(object):
"""Wait till ElasticSearch is ready, but return False if timeout."""
# We wait 20 minutes wall time since receiving the event until we
# treat the logs as missing
timeout = 1200
timeout = 300
# Wait 40 seconds between queries.
sleep_time = 40
sleep_time = 300
timed_out = False
job = None
# This checks that we've got the console log uploaded, need to retry

View File

@ -77,15 +77,16 @@ def result_ready(change, patchset, name, short_uuid):
"""
# TODO(dmsimard): Revisit this query once Zuul v2 is no longer supported
# Let's value legibility over pep8 line width here...
# build_short_uuid doesnt return the whole uuid in rdo es
query = (
'((filename:"job-output.txt" AND message:"POST-RUN END" AND message:"project-config/playbooks/base/post-ssh.yaml")' # noqa E501
'((filename:"job-output.txt" AND message:"POST-RUN END" AND message:"post.yaml")' # noqa E501
' OR '
'(filename:"console.html" AND (message:"[Zuul] Job complete" OR message:"[SCP] Copying console log" OR message:"Grabbing consoleLog")))' # noqa E501
' AND build_status:"FAILURE"'
' AND build_change:"{change}"'
' AND build_patchset:"{patchset}"'
' AND build_name:"{name}"'
' AND build_short_uuid:"{short_uuid}"'
' AND build_uuid:"{short_uuid}"'
)
return generic(query.format(
change=change,
@ -107,7 +108,7 @@ def files_ready(review, patch, name, build_short_uuid):
'AND build_change:"%s" '
'AND build_patchset:"%s" '
'AND build_name:"%s" '
'AND build_short_uuid:%s' %
'AND build_uuid:%s' %
(review, patch, name, build_short_uuid),
facet='filename')