Bug 1812379 - Re-clone the benchmark repo if the remote origins don't match. r=perftest-reviewers,kshampur

This patch fixes an issue where updating the repository origin causes a failure because we dont' check for changes there. With this change, we now check the URL before performing an update to make sure we have the correct repo. Otherwise, we'll fail on the revision validation step.

Differential Revision: https://phabricator.services.mozilla.com/D167834
This commit is contained in:
Greg Mierzwinski 2023-01-25 20:04:22 +00:00
parent b27f3c0973
commit 64ab08a741

View file

@ -241,7 +241,24 @@ class Benchmark(object):
# Locally, we should always do a full clone
self._full_clone(benchmark_repository, external_repo_path)
else:
self._update_benchmark_repo(external_repo_path)
# Make sure that the repo origin wasn't changed
url = (
subprocess.check_output(
["git", "config", "--get", "remote.origin.url"],
cwd=external_repo_path,
)
.decode("utf-8")
.strip()
)
if url != benchmark_repository:
LOG.info(
"Removing repo with a different remote origin before installing new one"
)
mozfile.remove(external_repo_path)
self._full_clone(benchmark_repository, external_repo_path)
else:
self._update_benchmark_repo(external_repo_path)
self._verify_benchmark_revision(benchmark_revision, external_repo_path)
subprocess.check_call(