Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete or reset Gitlab CI builds

Is it possible to delete old builds in Gitlab CI? I tested a few things and have now about 20 builds that are useless (most are failed anyway). It also shows stages that I don't have anymore which kinda clutters the Pipelines page and some of the uploaded artifacts are a bit big.

I wasn't able to find any documentation on this, only that disabling CI in the settings doesn't remove the builds.

Using Gitlab 8.10 Community (hosted by Gitlab.com)

like image 649
Johannes Bildstein Avatar asked Jul 23 '16 23:07

Johannes Bildstein


People also ask

Where is GitLab CI cache stored?

By default, they are stored locally in the machine where the Runner is installed and depends on the type of the executor. Locally, stored under the gitlab-runner user's home directory: /home/gitlab-runner/cache/<user>/<project>/<cache-key>/cache. zip .

Can we delete a pipeline GitLab?

Click the pipeline you want to remove in the pipelines list. Hit the red Delete button in the upper right of the pipeline details page.


1 Answers

There is currently no option in the GUI to completely get rid of a build other than expunge related data from the build. (The erase option in the build)

If you would have a local installation you could modify the database directly but I would advise caution. (I'll put the guide here for completeness sake)

  1. Login to the GitLab database. If you use the default PostgreSQL :

    sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
    
  2. Check if there is a table ci_builds. For pSQL: \dt

  3. Delete the builds with normal SQL. For example: DELETE FROM ci_builds WHERE id = 2

  4. (Optional) If you want to cleanup a list of commits which triggered a build you need to midify the table ci_commits.

like image 113
Fairy Avatar answered Sep 18 '22 14:09

Fairy