Tag Archives: Gitlab-runner Error

[Solved] Gitlab-runner Error: ERROR: Could not create cache adapter error=cache factory not found: factory for cache adapter “” was not registered

Background description:

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

There is a problem after using it for a period of time. An error is reported in the jar package generated after the project is 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 relevant error messages. I forgot to save the screenshot here.

After investigation, I learned that it was not the problem of gitlab runner, but the problem of gitlab

The specific problems are as follows:

The jar package generated after compiling the project will be provided to the dockerfile file for use. Here, artifacts are used

However, after each compilation, a directory will be generated in the corresponding directory of gitlab to store the jar package. The default path is: /var/opt/gitlab/gitlab rails/shared/artifacts

The directory inside is randomly generated to store the jar package generated after compiling with gitlab runner every time.

After a long time, this directory will occupy a large disk space. When the disk space is insufficient, the above error will be reported when compiling again.

Automatic solutions

Log in to gitlab with the administrator account, find the CI/CD in the settings, and set the validity period of the artifacts. In this way, you don’t have to delete them manually. When they expire, they will be deleted automatically

The solution here is to delete all folders except the tmp folder in this directory, that is, delete the existing folder for storing jar packages, and then use the gitlab runner tool to compile again