Нет хитов в GitLab CI для ccache - PullRequest
       90

Нет хитов в GitLab CI для ccache

0 голосов
/ 06 декабря 2018

ccache имеет нулевое число попаданий в кеш в GitLab CI, даже если источники не меняются и кеш сохраняетсяснова и снова.

1 Ответ

0 голосов
/ 06 декабря 2018

Проблема была в том, что ccache по умолчанию проверяет, является ли компилятор одинаковым - с помощью его временной метки.Поскольку каждый экземпляр GitLab CI запускает новый контейнер Docker, эта временная метка всегда отличается, поэтому всегда создается новый кэш.

Чтобы исправить это, установите CCACHE_COMPILERCHECK в content вместо значения по умолчанию mtime.

Из документации по ccache:

compiler_check (CCACHE_COMPILERCHECK)
By default, ccache includes the modification time (“mtime”) and size of the compiler in the hash to ensure that results retrieved from the cache are accurate. This setting can be used to select another strategy. Possible values are:
    content
        Hash the content of the compiler binary. This makes ccache very slightly slower compared to the mtime setting, but makes it cope better with compiler upgrades during a build bootstrapping process.
    mtime
        Hash the compiler’s mtime and size, which is fast. This is the default.
...