mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Fix race condition that causes InvalidGitRepositoryError
This commit is contained in:
@@ -1807,13 +1807,14 @@ class RunJob(BaseTask):
|
|||||||
logger.debug('Performing fresh clone of {} on this instance.'.format(job.project))
|
logger.debug('Performing fresh clone of {} on this instance.'.format(job.project))
|
||||||
sync_needs.append(source_update_tag)
|
sync_needs.append(source_update_tag)
|
||||||
elif job.project.scm_type == 'git' and job.project.scm_revision and (not branch_override):
|
elif job.project.scm_type == 'git' and job.project.scm_revision and (not branch_override):
|
||||||
git_repo = git.Repo(project_path)
|
|
||||||
try:
|
try:
|
||||||
|
git_repo = git.Repo(project_path)
|
||||||
|
|
||||||
if job_revision == git_repo.head.commit.hexsha:
|
if job_revision == git_repo.head.commit.hexsha:
|
||||||
logger.debug('Skipping project sync for {} because commit is locally available'.format(job.log_format))
|
logger.debug('Skipping project sync for {} because commit is locally available'.format(job.log_format))
|
||||||
else:
|
else:
|
||||||
sync_needs.append(source_update_tag)
|
sync_needs.append(source_update_tag)
|
||||||
except (ValueError, BadGitName):
|
except (ValueError, BadGitName, git.exc.InvalidGitRepositoryError):
|
||||||
logger.debug('Needed commit for {} not in local source tree, will sync with remote'.format(job.log_format))
|
logger.debug('Needed commit for {} not in local source tree, will sync with remote'.format(job.log_format))
|
||||||
sync_needs.append(source_update_tag)
|
sync_needs.append(source_update_tag)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user