mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +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 os
|
||||||
import pathlib
|
import pathlib
|
||||||
import resource
|
import resource
|
||||||
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Optional, TypeVar, Union, Sequence, Tuple, Dict
|
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/tmp.*')
|
||||||
repo.config('--add', 'remote.origin.fetch', '^refs/heads/staging.*')
|
repo.config('--add', 'remote.origin.fetch', '^refs/heads/staging.*')
|
||||||
return repo
|
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')
|
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)
|
# run on all repos with a forwardport target (~ forwardport enabled)
|
||||||
for repo in self.env['runbot_merge.repository'].search([]):
|
for repo in self.env['runbot_merge.repository'].search([]):
|
||||||
repo_git = get_local(repo, prefix=None)
|
repo_git = get_local(repo, prefix=None)
|
||||||
if not repo:
|
if not repo_git:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
_gc.info('Running maintenance on %s', repo.name)
|
_gc.info('Running maintenance on %s', repo.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user