Add more details to openQA job group description about current status
Example output from dry run: ``` 2017-11-24 06:42:57,927 - totest-manager:490 DEBUG snapshotable: True 2017-11-24 06:42:57,927 - totest-manager:495 DEBUG no change in snapshot version 2017-11-24 06:42:58,415 - totest-manager:207 DEBUG Writing openQA status message: {'text': 'pinned-description: Ignored issues\r\n\r\n\r\n\r\ntag:20171123:testing:testing'} ```
This commit is contained in:
parent
60cdcec090
commit
ebca12800b
@ -170,7 +170,7 @@ class ToTestBase(object):
|
|||||||
logger.info('%s %s %s' %
|
logger.info('%s %s %s' %
|
||||||
(module['name'], module['result'], module['flags']))
|
(module['name'], module['result'], module['flags']))
|
||||||
|
|
||||||
def update_ignored_issues(self):
|
def update_openqa_status_message(self):
|
||||||
url = makeurl(self.openqa_server,
|
url = makeurl(self.openqa_server,
|
||||||
['api', 'v1', 'job_groups'])
|
['api', 'v1', 'job_groups'])
|
||||||
f = self.api.retried_GET(url)
|
f = self.api.retried_GET(url)
|
||||||
@ -181,11 +181,20 @@ class ToTestBase(object):
|
|||||||
group_id = jg['id']
|
group_id = jg['id']
|
||||||
break
|
break
|
||||||
|
|
||||||
if group_id:
|
if not group_id:
|
||||||
|
logger.debug('No openQA group id found for status comment update, ignoring')
|
||||||
|
return
|
||||||
|
|
||||||
pinned_ignored_issue = 0
|
pinned_ignored_issue = 0
|
||||||
issues = ' , '.join(self.issues_to_ignore)
|
issues = ' , '.join(self.issues_to_ignore)
|
||||||
msg = "pinned-description: Ignored issues\r\n\r\n{}".format(issues)
|
status_flag = 'publishing' if self.status_for_openqa['is_publishing'] else \
|
||||||
|
'preparing' if self.status_for_openqa['can_release'] else \
|
||||||
|
'testing' if self.status_for_openqa['snapshotable'] else \
|
||||||
|
'building'
|
||||||
|
status_msg = "tag:{}:{}:{}".format(self.status_for_openqa['new_snapshot'], status_flag, status_flag)
|
||||||
|
msg = "pinned-description: Ignored issues\r\n\r\n{}\r\n\r\n{}".format(issues, status_msg)
|
||||||
data = {'text': msg}
|
data = {'text': msg}
|
||||||
|
|
||||||
url = makeurl(self.openqa_server,
|
url = makeurl(self.openqa_server,
|
||||||
['api', 'v1', 'groups', str(group_id), 'comments'])
|
['api', 'v1', 'groups', str(group_id), 'comments'])
|
||||||
f = self.api.retried_GET(url)
|
f = self.api.retried_GET(url)
|
||||||
@ -195,6 +204,7 @@ class ToTestBase(object):
|
|||||||
comment['text'].startswith('pinned-description: Ignored issues'):
|
comment['text'].startswith('pinned-description: Ignored issues'):
|
||||||
pinned_ignored_issue = comment['id']
|
pinned_ignored_issue = comment['id']
|
||||||
|
|
||||||
|
logger.debug('Writing openQA status message: {}'.format(data))
|
||||||
if not self.dryrun:
|
if not self.dryrun:
|
||||||
if pinned_ignored_issue:
|
if pinned_ignored_issue:
|
||||||
self.openqa.openqa_request(
|
self.openqa.openqa_request(
|
||||||
@ -217,7 +227,7 @@ class ToTestBase(object):
|
|||||||
|
|
||||||
number_of_fails = 0
|
number_of_fails = 0
|
||||||
in_progress = False
|
in_progress = False
|
||||||
update_pinned_descr = False
|
self.update_pinned_descr = False
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
# print json.dumps(job, sort_keys=True, indent=4)
|
# print json.dumps(job, sort_keys=True, indent=4)
|
||||||
if job['result'] in ('failed', 'incomplete', 'skipped', 'user_cancelled', 'obsoleted', 'parallel_failed'):
|
if job['result'] in ('failed', 'incomplete', 'skipped', 'user_cancelled', 'obsoleted', 'parallel_failed'):
|
||||||
@ -242,7 +252,7 @@ class ToTestBase(object):
|
|||||||
if ref not in self.issues_to_ignore:
|
if ref not in self.issues_to_ignore:
|
||||||
if to_ignore:
|
if to_ignore:
|
||||||
self.issues_to_ignore.append(ref)
|
self.issues_to_ignore.append(ref)
|
||||||
update_pinned_descr = True
|
self.update_pinned_descr = True
|
||||||
with open(self.issuefile, 'a') as f:
|
with open(self.issuefile, 'a') as f:
|
||||||
f.write("%s\n" % ref)
|
f.write("%s\n" % ref)
|
||||||
else:
|
else:
|
||||||
@ -274,9 +284,6 @@ class ToTestBase(object):
|
|||||||
else:
|
else:
|
||||||
raise Exception(job['result'])
|
raise Exception(job['result'])
|
||||||
|
|
||||||
if update_pinned_descr:
|
|
||||||
self.update_ignored_issues()
|
|
||||||
|
|
||||||
if number_of_fails > 0:
|
if number_of_fails > 0:
|
||||||
return QA_FAILED
|
return QA_FAILED
|
||||||
|
|
||||||
@ -496,10 +503,21 @@ class ToTestBase(object):
|
|||||||
can_publish = (current_result == QA_PASSED)
|
can_publish = (current_result == QA_PASSED)
|
||||||
|
|
||||||
# already published
|
# already published
|
||||||
if self.totest_is_publishing():
|
totest_is_publishing = self.totest_is_publishing()
|
||||||
|
if totest_is_publishing:
|
||||||
logger.debug("totest already publishing")
|
logger.debug("totest already publishing")
|
||||||
can_publish = False
|
can_publish = False
|
||||||
|
|
||||||
|
if self.update_pinned_descr:
|
||||||
|
self.status_for_openqa = {
|
||||||
|
'current_snapshot': current_snapshot,
|
||||||
|
'new_snapshot': new_snapshot,
|
||||||
|
'snapshotable': snapshotable,
|
||||||
|
'can_release': can_release,
|
||||||
|
'is_publishing': totest_is_publishing,
|
||||||
|
}
|
||||||
|
self.update_openqa_status_message()
|
||||||
|
|
||||||
if can_publish:
|
if can_publish:
|
||||||
if current_qa_version == current_snapshot:
|
if current_qa_version == current_snapshot:
|
||||||
self.publish_factory_totest()
|
self.publish_factory_totest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user