Before we checkout a ref try resetting the workdir to HEAD
Some repos have the AUTHORS file checked in and when to generate the sdist we may update that file[1]. This causes later checkouts to fail[2]. Lets just reset the workdir to HEAD before we try to check anything out. [1] http://logs.openstack.org/54/652854/2/check/openstack-tox-validate/5bab7e7/job-output.txt.gz#_2019-04-17_05_24_27_485692 [2] http://logs.openstack.org/54/652854/2/check/openstack-tox-validate/5bab7e7/job-output.txt.gz#_2019-04-17_05_24_28_115433 Change-Id: I2a28105c25589f588ca62eb61b8f185c5312dbb3
This commit is contained in:
parent
fe4d9d87b3
commit
8f474f5837
@ -129,8 +129,21 @@ def safe_clone_repo(workdir, repo, ref, messages):
|
||||
|
||||
def checkout_ref(workdir, repo, ref, messages):
|
||||
"""Checkout a specific ref in the repo."""
|
||||
LOG.debug('Checking out repository %s to %s', repo, ref)
|
||||
|
||||
LOG.debug('Resetting the repository %s to HEAD', repo)
|
||||
# Reset the repo to HEAD just in case any ot the previous steps
|
||||
# updated a checked in file. If this fails we continue to try the
|
||||
# requested ref as that shoudl give us a more complete error log.
|
||||
try:
|
||||
processutils.check_call(
|
||||
['git', 'reset', '--hard'],
|
||||
cwd=os.path.join(workdir, repo))
|
||||
except processutils.CalledProcessError as err:
|
||||
messages.warning(
|
||||
'Could not reset repository {} to HEAD: {}'.format(
|
||||
repo, err))
|
||||
|
||||
LOG.debug('Checking out repository %s to %s', repo, ref)
|
||||
try:
|
||||
processutils.check_call(
|
||||
['git', 'checkout', ref],
|
||||
|
Loading…
Reference in New Issue
Block a user