From cfd806aeff30818d2c1a909780f141ae0ac8dfef Mon Sep 17 00:00:00 2001
From: Paul Bourke <paul.bourke@oracle.com>
Date: Tue, 5 Apr 2016 12:03:47 +0100
Subject: [PATCH] Log the SHA of the Git ref for source builds

When using named refs in source builds, e.g. "reference = master", one
can't easily tell from the build output what SHA master actually pointed
to at that point and time. Update the debug output to include this.

Closes-Bug: #1566316

Change-Id: I95c1cc316ab7332fa30fa43e207a5a5512b76708
---
 kolla/cmd/build.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index 1bb8d8076..f5a8ccef9 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -194,9 +194,10 @@ class WorkerThread(threading.Thread):
                 LOG.debug("%s:Cloning from %s", image['name'],
                           source['source'])
                 git.Git().clone(source['source'], clone_dir)
-                LOG.debug("%s:Git checkout by reference %s",
-                          image['name'], source['reference'])
                 git.Git(clone_dir).checkout(source['reference'])
+                reference_sha = git.Git(clone_dir).rev_parse('HEAD')
+                LOG.debug("%s:Git checkout by reference %s (%s)",
+                          image['name'], source['reference'], reference_sha)
             except Exception as e:
                 LOG.error("%s:Failed to get source from git", image['name'])
                 LOG.error("%s:Error:%s", image['name'], str(e))
-- 
GitLab