[FIX] runbot: stop forcing git gc --auto during updates

The `git gc --auto` command often fails and requires an explicit
execution of `git gc --prune=all`. When it happens, it crashes the
update, failing the cron execution.

Executing `git gc prune` every time would be very slow and dispruptive
during the cron's critical sections.

As the initial goal was to avoid triggering the automatic GC during the
next update/pull command, we prefer to adopt the global strategy of
disabling the auto GC globally with:

  git config --global gc.auto 0

And to configure a system cron job to periodically GC/prune all
repositories, to get the performance benefit.
Due to locking issues, that cronjob should be scheduled outside peak
build hours.

Example bash script for the system cron:

```
   #!/bin/bash
   set -e
   base_repo_dir='/path/to/runbot/static/repo'

   for repo in $base_repo_dir/*
   do
       if [[ -d $repo ]];then
           git --git-dir="$repo" gc --prune=all
       fi
   done
```
This commit is contained in:
Olivier Dony 2017-05-16 10:48:04 +02:00
parent a5b88ff0ab
commit 8dfee8af40

View File

@ -303,7 +303,6 @@ class runbot_repo(osv.osv):
repo.name, int(t0 - fetch_time), int(t0 - dt2time(repo.hook_time)))
return
repo._git(['gc', '--auto', '--prune=all'])
repo._git(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
repo._git(['fetch', '-p', 'origin', '+refs/pull/*/head:refs/pull/*'])