ERROR: Could not create cache adapter error=cache factory not found: factory for cache adapter "" was not registered

created at 08-31-2021 views: 77

Background description:]

The project uses the gitlab-runner function to be automatically triggered after the code is submitted, then compile the project, make it into a docker image, and upload it to the nexus warehouse.

A problem occurred after using for a period of time. An error was reported here in the jar package generated after the project was compiled. The specific information is as follows:
This error message is the error message of the gitlab-runner tool

ERROR: Could not create cache adapter      error=cache factory not found: factory for cache adapter "" was not registere

The gitlab compilation page will also display related error messages. I forgot to save the screenshot here.

After investigation, I learned that it is not the problem of gitlab-runner, but the problem of gitlab.

details of the problem

The jar package generated after compiling the project will be provided to the Dockerfile for use, where artifacts are used.
But after each compilation, a directory will be generated to store this jar package in the corresponding directory of gitlab. The default path is: /var/opt/gitlab/gitlab-rails/shared/artifacts

The directory inside is randomly generated to store the jar package generated after each compilation with gitlab-runner.

After a long time, this directory will take up a relatively large disk space. When the disk space is not enough, the above error will be reported when compiling again.

Automatic solution

Use the administrator account to log in to gitlab, find the CI/CD in the settings, and set the validity period of the artifacts, so that there is no need to manually delete them, and they will be deleted automatically when they expire.

gitlab

The solution here is to delete all folders in this directory except the tmp folder, that is, delete the existing folder that stores the jar package, and then use the gitlab-runner tool to compile again.

created at:08-31-2021
edited at: 08-31-2021: