Skip to content

Commit 8261ab4

Browse files
committed
contest: fetcher: fix old branch cleanup
We are accumulating branches on all runners, the cleanup must not be working. It's most likely because we forgot to set the cwd. Make sure we check if the commands failed. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8e7fece commit 8261ab4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

contest/remote/lib/fetcher.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,18 @@ def _run_test(self, binfo):
105105
self._result_set(binfo['branch'], url)
106106

107107
def _clean_old_branches(self, remote, current):
108-
ret = subprocess.run('git branch', shell=True, capture_output=True)
108+
ret = subprocess.run('git branch',
109+
cwd=self._tree_path, shell=True,
110+
capture_output=True, check=True)
111+
109112
existing = set([x.strip() for x in ret.stdout.decode('utf-8').split('\n')])
110113

111114
for b in remote:
112115
if b["branch"] in existing and b["branch"] != current:
113-
subprocess.run('git branch -d ' + b["branch"],
114-
cwd=self._tree_path, shell=True)
116+
print("Clean up old branch", b["branch"])
117+
subprocess.run('git branch -D ' + b["branch"],
118+
cwd=self._tree_path, shell=True,
119+
check=True)
115120

116121
def _run_once(self):
117122
r = requests.get(self._branches_url)

0 commit comments

Comments
 (0)