diff options
author | James E. Blair <jim@acmegating.com> | 2022-04-13 14:44:51 -0700 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2022-04-13 16:53:21 -0700 |
commit | 1cd1d3f4de712d47f5bef49c7030cacf8f28ff11 (patch) | |
tree | 4abb04dbd424719a3902930e54048363745381ed /zuul/merger | |
parent | d6ace2cec617f77786fd72e847d6c4f00538834c (diff) | |
download | zuul-1cd1d3f4de712d47f5bef49c7030cacf8f28ff11.tar.gz |
Delete repo if unable to reset
If a merger or executor is unable to reset a repo, we currently
simply log the message "Unable to reset repo". Instead, let's
assume that it is permanently broken and rmtree it so that future
attempts will automatically recover.
Change-Id: I17b051d70a9c5800019bf9ef7e0800558614cadd
Diffstat (limited to 'zuul/merger')
-rw-r--r-- | zuul/merger/merger.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/zuul/merger/merger.py b/zuul/merger/merger.py index 9ef5be265..3aaafc20f 100644 --- a/zuul/merger/merger.py +++ b/zuul/merger/merger.py @@ -401,13 +401,18 @@ class Repo(object): log.debug("Resetting repository %s", self.local_path) self.createRepoObject(zuul_event_id, build=build) - if process_worker is None: - self._reset(self.local_path, self.env, log) - else: - job = process_worker.submit(Repo._reset, self.local_path, self.env) - messages = job.result() - for message in messages: - log.debug(message) + try: + if process_worker is None: + self._reset(self.local_path, self.env, log) + else: + job = process_worker.submit( + Repo._reset, self.local_path, self.env) + messages = job.result() + for message in messages: + log.debug(message) + except Exception: + shutil.rmtree(self.local_path) + raise def getBranchHead(self, branch, zuul_event_id=None): repo = self.createRepoObject(zuul_event_id) |