mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot_merge: error in maintenance, and tracking
Before this, we would check if a repository had a name and run maintenance on it, leading to repeated (but unnoticed until now because I didn't monitor it) tracebacks as the maintenance cron would fail to find the local repo then run maintenance on nowhere anyway. Also augment the repo-finding process to try and get better information about what it's doing when it fails, rather than failing completely silently.
This commit is contained in:
parent
5d615bd733
commit
de32b54090
@ -4,6 +4,7 @@ import logging
|
||||
import os
|
||||
import pathlib
|
||||
import resource
|
||||
import stat
|
||||
import subprocess
|
||||
from typing import Optional, TypeVar, Union, Sequence, Tuple, Dict
|
||||
|
||||
@ -41,6 +42,14 @@ def get_local(repository, prefix: Optional[str]) -> 'Optional[Repo]':
|
||||
repo.config('--add', 'remote.origin.fetch', '^refs/heads/tmp.*')
|
||||
repo.config('--add', 'remote.origin.fetch', '^refs/heads/staging.*')
|
||||
return repo
|
||||
else:
|
||||
_logger.warning(
|
||||
"Unable to acquire %s: %s",
|
||||
repo_dir,
|
||||
"doesn't exist" if not repo_dir.exists()\
|
||||
else oct(stat.S_IFMT(repo_dir.stat().st_mode))
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
ALWAYS = ('gc.auto=0', 'maintenance.auto=0')
|
||||
|
@ -25,7 +25,7 @@ class GC(models.TransientModel):
|
||||
# run on all repos with a forwardport target (~ forwardport enabled)
|
||||
for repo in self.env['runbot_merge.repository'].search([]):
|
||||
repo_git = get_local(repo, prefix=None)
|
||||
if not repo:
|
||||
if not repo_git:
|
||||
continue
|
||||
|
||||
_gc.info('Running maintenance on %s', repo.name)
|
||||
|
Loading…
Reference in New Issue
Block a user