build: add timestamps to start/end of build
During recent CI issues I got an idea that it would be nice to have information how much time building specific image took. On local systems we can do log and then check 'modified_time - creation_time' but not on CI jobs. Fresh image: INFO:kolla.common.utils.base:Building started at 2019-06-26 13:53:08.393544 INFO:kolla.common.utils.base:Ended at 2019-06-26 13:56:40.354761 (took 0:03:31.961225) Rebuild: INFO:kolla.common.utils.base:Building started at 2019-06-26 14:00:34.913194 INFO:kolla.common.utils.base:Built at 2019-06-26 14:00:38.988874 (took 0:00:04.075686) Failed images do not get second line due to logger.exception() being used. Change-Id: Id13545224fa0fbb729d46386a10505e0989fc3c6
This commit is contained in:
parent
414d61836f
commit
6e505affde
@ -489,7 +489,8 @@ class BuildTask(DockerTask):
|
||||
return
|
||||
|
||||
image.status = STATUS_BUILDING
|
||||
self.logger.info('Building')
|
||||
image.start = datetime.datetime.now()
|
||||
self.logger.info('Building started at %s' % image.start)
|
||||
|
||||
if image.source and 'source' in image.source:
|
||||
self.process_source(image, image.source)
|
||||
@ -554,7 +555,9 @@ class BuildTask(DockerTask):
|
||||
self.logger.exception('Unknown error when building')
|
||||
else:
|
||||
image.status = STATUS_BUILT
|
||||
self.logger.info('Built')
|
||||
now = datetime.datetime.now()
|
||||
self.logger.info('Built at %s (took %s)' %
|
||||
(now, now - image.start))
|
||||
|
||||
def squash(self):
|
||||
image_tag = self.image.canonical_name
|
||||
|
Loading…
Reference in New Issue
Block a user