aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2019-06-26 13:55:32 +0200
committerMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2019-06-26 15:31:58 +0200
commit6e505affde45168ca3246f9377fa880dbe624c76 (patch)
tree49822aafe113119a9495a14e86ac7915792761b6
parent414d61836fb909b16a76f9dbcfcefd5d5523e248 (diff)
downloadkolla-6e505affde45168ca3246f9377fa880dbe624c76.tar.gz
kolla-6e505affde45168ca3246f9377fa880dbe624c76.zip
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
-rwxr-xr-xkolla/image/build.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 4e37677d3..83e8f85cd 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -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