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
changes/83/301583/2
Paul Bourke 7 years ago
parent 5f6d4d10d4
commit cfd806aeff

@ -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))

Loading…
Cancel
Save