builder: log compose-status.json during the build
Instead of just uploading the compose-status.json at the very end of the build, keep updating it every time it is fetch. This makes it easier to follow along, especially if there are multiple image request being built.
This commit is contained in:
parent
800682c9bb
commit
ae90d5f2c7
1 changed files with 8 additions and 3 deletions
|
|
@ -236,9 +236,12 @@ class Client:
|
||||||
|
|
||||||
return ComposeLogs.from_dict(res.json())
|
return ComposeLogs.from_dict(res.json())
|
||||||
|
|
||||||
def wait_for_compose(self, compose_id: str, *, sleep_time=2):
|
def wait_for_compose(self, compose_id: str, *, sleep_time=2, callback=None):
|
||||||
while True:
|
while True:
|
||||||
status = self.compose_status(compose_id)
|
status = self.compose_status(compose_id)
|
||||||
|
if callback:
|
||||||
|
callback(status)
|
||||||
|
|
||||||
if status.is_finished:
|
if status.is_finished:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
@ -349,6 +352,9 @@ class OSBuildImage(BaseTaskHandler):
|
||||||
arch='noarch')
|
arch='noarch')
|
||||||
self.wait(task)
|
self.wait(task)
|
||||||
|
|
||||||
|
def on_status_update(self, status: ComposeStatus):
|
||||||
|
self.upload_json(status.as_dict(), "compose-status")
|
||||||
|
|
||||||
# pylint: disable=arguments-differ
|
# pylint: disable=arguments-differ
|
||||||
def handler(self, name, version, distro, image_types, target, arches, opts):
|
def handler(self, name, version, distro, image_types, target, arches, opts):
|
||||||
"""Main entry point for the task"""
|
"""Main entry point for the task"""
|
||||||
|
|
@ -400,12 +406,11 @@ class OSBuildImage(BaseTaskHandler):
|
||||||
self.logger.info("Compose id: %s, Koji build id: %s", cid, bid)
|
self.logger.info("Compose id: %s, Koji build id: %s", cid, bid)
|
||||||
|
|
||||||
self.logger.debug("Waiting for comose to finish")
|
self.logger.debug("Waiting for comose to finish")
|
||||||
status = client.wait_for_compose(cid)
|
status = client.wait_for_compose(cid, callback=self.on_status_update)
|
||||||
|
|
||||||
self.logger.debug("Compose finished: %s", str(status.as_dict()))
|
self.logger.debug("Compose finished: %s", str(status.as_dict()))
|
||||||
self.logger.info("Compose result: %s", status.status)
|
self.logger.info("Compose result: %s", status.status)
|
||||||
|
|
||||||
self.upload_json(status.as_dict(), "compose-status")
|
|
||||||
self.attach_logs(cid, ireqs)
|
self.attach_logs(cid, ireqs)
|
||||||
|
|
||||||
if not status.is_success:
|
if not status.is_success:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue